This begins the process of merging image_comment_temp into the image table by adding the needed column. Iab5f5215 will adjust the code to use it and to add the necessary migration script. Note this patch puts the new schema change in the 1.30 section rather than the 1.31 section. This allows Iab5f5215 to have migrateComments.php migrate the comments directly to the new field instead of having to populate and then depopulate the temporary table. Bug: T188132 Change-Id: I2485c5a758bf03bb2b4991eea920abd9d0d30bda
47 lines
2 KiB
PL/PgSQL
47 lines
2 KiB
PL/PgSQL
--
|
|
-- patch-image-img_description_id.sql
|
|
--
|
|
-- T188132. Add `img_description_id` to the `image` table.
|
|
|
|
BEGIN;
|
|
|
|
DROP TABLE IF EXISTS /*_*/image_tmp;
|
|
CREATE TABLE /*_*/image_tmp (
|
|
img_name varchar(255) binary NOT NULL default '' PRIMARY KEY,
|
|
img_size int unsigned NOT NULL default 0,
|
|
img_width int NOT NULL default 0,
|
|
img_height int NOT NULL default 0,
|
|
img_metadata mediumblob NOT NULL,
|
|
img_bits int NOT NULL default 0,
|
|
img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL,
|
|
img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown",
|
|
img_minor_mime varbinary(100) NOT NULL default "unknown",
|
|
img_description varbinary(767) NOT NULL default '',
|
|
img_description_id bigint unsigned NOT NULL DEFAULT 0,
|
|
img_user int unsigned NOT NULL default 0,
|
|
img_user_text varchar(255) binary NOT NULL default '',
|
|
img_timestamp varbinary(14) NOT NULL default '',
|
|
img_sha1 varbinary(32) NOT NULL default ''
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
INSERT OR IGNORE INTO /*_*/image_tmp (
|
|
img_name, img_size, img_width, img_height, img_metadata, img_bits,
|
|
img_media_type, img_major_mime, img_minor_mime, img_description, img_user,
|
|
img_user_text, img_timestamp, img_sha1)
|
|
SELECT
|
|
img_name, img_size, img_width, img_height, img_metadata, img_bits,
|
|
img_media_type, img_major_mime, img_minor_mime, img_description, img_user,
|
|
img_user_text, img_timestamp, img_sha1
|
|
FROM /*_*/image;
|
|
|
|
DROP TABLE /*_*/image;
|
|
ALTER TABLE /*_*/image_tmp RENAME TO /*_*/image;
|
|
CREATE INDEX /*i*/img_user_timestamp ON /*_*/image (img_user,img_timestamp);
|
|
CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp);
|
|
CREATE INDEX /*i*/img_size ON /*_*/image (img_size);
|
|
CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp);
|
|
CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1(10));
|
|
CREATE INDEX /*i*/img_media_mime ON /*_*/image (img_media_type,img_major_mime,img_minor_mime);
|
|
|
|
COMMIT;
|