Split down patch-comment-table.sql
authorReedy <reedy@wikimedia.org>
Thu, 15 Aug 2019 13:36:53 +0000 (14:36 +0100)
committerReedy <reedy@wikimedia.org>
Tue, 20 Aug 2019 19:35:57 +0000 (19:35 +0000)
Bug: T227662
Change-Id: I7617616df57f7468d06e9b52426b6851bfef0e7d

27 files changed:
includes/installer/MysqlUpdater.php
includes/installer/PostgresUpdater.php
includes/installer/SqliteUpdater.php
maintenance/archives/patch-archive-ar_comment_id.sql [new file with mode: 0644]
maintenance/archives/patch-comment-table.sql
maintenance/archives/patch-filearchive-fa_description_id.sql [new file with mode: 0644]
maintenance/archives/patch-image-img_description-default.sql [new file with mode: 0644]
maintenance/archives/patch-image_comment_temp-table.sql [new file with mode: 0644]
maintenance/archives/patch-ipblocks-ipb_reason_id.sql [new file with mode: 0644]
maintenance/archives/patch-logging-log_comment_id.sql [new file with mode: 0644]
maintenance/archives/patch-oldimage-oi_description_id.sql [new file with mode: 0644]
maintenance/archives/patch-protected_titles-pt_reason_id.sql [new file with mode: 0644]
maintenance/archives/patch-recentchanges-rc_comment_id.sql [new file with mode: 0644]
maintenance/archives/patch-revision-rev_comment-default.sql [new file with mode: 0644]
maintenance/archives/patch-revision_comment_temp-table.sql [new file with mode: 0644]
maintenance/postgres/archives/patch-comment-table.sql
maintenance/postgres/archives/patch-image_comment_temp-table.sql [new file with mode: 0644]
maintenance/postgres/archives/patch-revision_comment_temp-table.sql [new file with mode: 0644]
maintenance/sqlite/archives/patch-archive-ar_comment_id.sql [new file with mode: 0644]
maintenance/sqlite/archives/patch-comment-table.sql [deleted file]
maintenance/sqlite/archives/patch-image-img_description-default.sql [new file with mode: 0644]
maintenance/sqlite/archives/patch-ipblocks-ipb_reason_id.sql [new file with mode: 0644]
maintenance/sqlite/archives/patch-logging-log_comment_id.sql [new file with mode: 0644]
maintenance/sqlite/archives/patch-oldimage-oi_description_id.sql [new file with mode: 0644]
maintenance/sqlite/archives/patch-protected_titles-pt_reason_id.sql [new file with mode: 0644]
maintenance/sqlite/archives/patch-recentchanges-rc_comment_id.sql [new file with mode: 0644]
maintenance/sqlite/archives/patch-revision-rev_comment-default.sql [new file with mode: 0644]

index c33d3dd..9df0b82 100644 (file)
@@ -319,6 +319,20 @@ class MysqlUpdater extends DatabaseUpdater {
                        [ 'renameIndex', 'user_properties', 'user_properties_user_property', 'PRIMARY', false,
                                'patch-user_properties-fix-pk.sql' ],
                        [ 'addTable', 'comment', 'patch-comment-table.sql' ],
+                       [ 'addTable', 'revision_comment_temp', 'patch-revision_comment_temp-table.sql' ],
+                       // image_comment_temp is no longer needed when upgrading to MW 1.31 or newer,
+                       // as it is dropped later in the update process as part of 'migrateImageCommentTemp'.
+                       // File kept on disk and the updater entry here for historical purposes.
+                       // [ 'addTable', 'image_comment_temp', 'patch-image_comment_temp-table.sql' ],
+                       [ 'addField', 'archive', 'ar_comment_id', 'patch-archive-ar_comment_id.sql' ],
+                       [ 'addField', 'filearchive', 'fa_description_id', 'patch-filearchive-fa_description_id.sql' ],
+                       [ 'modifyField', 'image', 'img_description', 'patch-image-img_description-default..sql' ],
+                       [ 'addField', 'ipblocks', 'ipb_reason_id', 'patch-ipblocks-ipb_reason_id.sql' ],
+                       [ 'addField', 'logging', 'log_comment_id', 'patch-logging-log_comment_id.sql' ],
+                       [ 'addField', 'oldimage', 'oi_description_id', 'patch-oldimage-oi_description_id.sql' ],
+                       [ 'addField', 'protected_titles', 'pt_reason_id', 'patch-protected_titles-pt_reason_id.sql' ],
+                       [ 'addField', 'recentchanges', 'rc_comment_id', 'patch-recentchanges-rc_comment_id.sql' ],
+                       [ 'modifyField', 'revision', 'rev_comment', 'patch-revision-rev_comment-default.sql' ],
 
                        // This field was added in 1.31, but is put here so it can be used by 'migrateComments'
                        [ 'addField', 'image', 'img_description_id', 'patch-image-img_description_id.sql' ],
index 31827a1..8b3fb37 100644 (file)
@@ -476,6 +476,11 @@ class PostgresUpdater extends DatabaseUpdater {
                        [ 'changeNullableField', 'protected_titles', 'pt_reason', 'NOT NULL', true ],
                        [ 'addPgField', 'protected_titles', 'pt_reason_id', 'INTEGER NOT NULL DEFAULT 0' ],
                        [ 'addTable', 'comment', 'patch-comment-table.sql' ],
+                       [ 'addTable', 'revision_comment_temp', 'patch-revision_comment_temp-table.sql' ],
+                       // image_comment_temp is no longer needed when upgrading to MW 1.31 or newer,
+                       // as it is dropped later in the update process as part of 'migrateImageCommentTemp'.
+                       // File kept on disk and the updater entry here for historical purposes.
+                       // [ 'addTable', 'image_comment_temp', 'patch-image_comment_temp-table.sql' ],
 
                        // This field was added in 1.31, but is put here so it can be used by 'migrateComments'
                        [ 'addPgField', 'image', 'img_description_id', 'INTEGER NOT NULL DEFAULT 0' ],
index 17ced50..b333c16 100644 (file)
@@ -185,6 +185,19 @@ class SqliteUpdater extends DatabaseUpdater {
                        [ 'renameIndex', 'user_properties', 'user_properties_user_property', 'PRIMARY', false,
                                'patch-user_properties-fix-pk.sql' ],
                        [ 'addTable', 'comment', 'patch-comment-table.sql' ],
+                       [ 'addTable', 'revision_comment_temp', 'patch-revision_comment_temp-table.sql' ],
+                       // image_comment_temp is no longer needed when upgrading to MW 1.31 or newer,
+                       // as it is dropped later in the update process as part of 'migrateImageCommentTemp'.
+                       // File kept on disk and the updater entry here for historical purposes.
+                       // [ 'addTable', 'image_comment_temp', 'patch-image_comment_temp-table.sql' ],
+                       [ 'addField', 'archive', 'ar_comment_id', 'patch-archive-ar_comment_id.sql' ],
+                       [ 'modifyField', 'image', 'img_description', 'patch-image-img_description-default..sql' ],
+                       [ 'addField', 'ipblocks', 'ipb_reason_id', 'patch-ipblocks-ipb_reason_id.sql' ],
+                       [ 'addField', 'logging', 'log_comment_id', 'patch-logging-log_comment_id.sql' ],
+                       [ 'addField', 'oldimage', 'oi_description_id', 'patch-oldimage-oi_description_id.sql' ],
+                       [ 'addField', 'protected_titles', 'pt_reason_id', 'patch-protected_titles-pt_reason_id.sql' ],
+                       [ 'addField', 'recentchanges', 'rc_comment_id', 'patch-recentchanges-rc_comment_id.sql' ],
+                       [ 'modifyField', 'revision', 'rev_comment', 'patch-revision-rev_comment-default.sql' ],
 
                        // This field was added in 1.31, but is put here so it can be used by 'migrateComments'
                        [ 'addField', 'image', 'img_description_id', 'patch-image-img_description_id.sql' ],
diff --git a/maintenance/archives/patch-archive-ar_comment_id.sql b/maintenance/archives/patch-archive-ar_comment_id.sql
new file mode 100644 (file)
index 0000000..cb7b8a7
--- /dev/null
@@ -0,0 +1,3 @@
+ALTER TABLE /*_*/archive
+  ALTER COLUMN ar_comment SET DEFAULT '',
+  ADD COLUMN ar_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER ar_comment;
index c8bf958..bbe7810 100644 (file)
@@ -1,7 +1,7 @@
 --
 -- patch-comment-table.sql
 --
--- T166732. Add a `comment` table and various columns (and temporary tables) to reference it.
+-- T166732. Add a `comment` table.
 
 CREATE TABLE /*_*/comment (
   comment_id bigint unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
@@ -10,50 +10,3 @@ CREATE TABLE /*_*/comment (
   comment_data BLOB
 ) /*$wgDBTableOptions*/;
 CREATE INDEX /*i*/comment_hash ON /*_*/comment (comment_hash);
-
-CREATE TABLE /*_*/revision_comment_temp (
-  revcomment_rev int unsigned NOT NULL,
-  revcomment_comment_id bigint unsigned NOT NULL,
-  PRIMARY KEY (revcomment_rev, revcomment_comment_id)
-) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/revcomment_rev ON /*_*/revision_comment_temp (revcomment_rev);
-
-CREATE TABLE /*_*/image_comment_temp (
-  imgcomment_name varchar(255) binary NOT NULL,
-  imgcomment_description_id bigint unsigned NOT NULL,
-  PRIMARY KEY (imgcomment_name, imgcomment_description_id)
-) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/imgcomment_name ON /*_*/image_comment_temp (imgcomment_name);
-
-ALTER TABLE /*_*/revision
-  ALTER COLUMN rev_comment SET DEFAULT '';
-
-ALTER TABLE /*_*/archive
-  ALTER COLUMN ar_comment SET DEFAULT '',
-  ADD COLUMN ar_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER ar_comment;
-
-ALTER TABLE /*_*/ipblocks
-  ALTER COLUMN ipb_reason SET DEFAULT '',
-  ADD COLUMN ipb_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER ipb_reason;
-
-ALTER TABLE /*_*/image
-  ALTER COLUMN img_description SET DEFAULT '';
-
-ALTER TABLE /*_*/oldimage
-  ALTER COLUMN oi_description SET DEFAULT '',
-  ADD COLUMN oi_description_id bigint unsigned NOT NULL DEFAULT 0 AFTER oi_description;
-
-ALTER TABLE /*_*/filearchive
-  ADD COLUMN fa_deleted_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER fa_deleted_reason,
-  ALTER COLUMN fa_description SET DEFAULT '',
-  ADD COLUMN fa_description_id bigint unsigned NOT NULL DEFAULT 0 AFTER fa_description;
-
-ALTER TABLE /*_*/recentchanges
-  ADD COLUMN rc_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER rc_comment;
-
-ALTER TABLE /*_*/logging
-  ADD COLUMN log_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER log_comment;
-
-ALTER TABLE /*_*/protected_titles
-  ALTER COLUMN pt_reason SET DEFAULT '',
-  ADD COLUMN pt_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER pt_reason;
diff --git a/maintenance/archives/patch-filearchive-fa_description_id.sql b/maintenance/archives/patch-filearchive-fa_description_id.sql
new file mode 100644 (file)
index 0000000..93ddd50
--- /dev/null
@@ -0,0 +1,4 @@
+ALTER TABLE /*_*/filearchive
+  ADD COLUMN fa_deleted_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER fa_deleted_reason,
+  ALTER COLUMN fa_description SET DEFAULT '',
+  ADD COLUMN fa_description_id bigint unsigned NOT NULL DEFAULT 0 AFTER fa_description;
diff --git a/maintenance/archives/patch-image-img_description-default.sql b/maintenance/archives/patch-image-img_description-default.sql
new file mode 100644 (file)
index 0000000..43d54dc
--- /dev/null
@@ -0,0 +1,2 @@
+ALTER TABLE /*_*/image
+  ALTER COLUMN img_description SET DEFAULT '';
diff --git a/maintenance/archives/patch-image_comment_temp-table.sql b/maintenance/archives/patch-image_comment_temp-table.sql
new file mode 100644 (file)
index 0000000..f873c91
--- /dev/null
@@ -0,0 +1,6 @@
+CREATE TABLE /*_*/image_comment_temp (
+  imgcomment_name varchar(255) binary NOT NULL,
+  imgcomment_description_id bigint unsigned NOT NULL,
+  PRIMARY KEY (imgcomment_name, imgcomment_description_id)
+) /*$wgDBTableOptions*/;
+CREATE UNIQUE INDEX /*i*/imgcomment_name ON /*_*/image_comment_temp (imgcomment_name);
diff --git a/maintenance/archives/patch-ipblocks-ipb_reason_id.sql b/maintenance/archives/patch-ipblocks-ipb_reason_id.sql
new file mode 100644 (file)
index 0000000..8816a7f
--- /dev/null
@@ -0,0 +1,3 @@
+ALTER TABLE /*_*/ipblocks
+  ALTER COLUMN ipb_reason SET DEFAULT '',
+  ADD COLUMN ipb_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER ipb_reason;
diff --git a/maintenance/archives/patch-logging-log_comment_id.sql b/maintenance/archives/patch-logging-log_comment_id.sql
new file mode 100644 (file)
index 0000000..0032900
--- /dev/null
@@ -0,0 +1,2 @@
+ALTER TABLE /*_*/logging
+  ADD COLUMN log_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER log_comment;
diff --git a/maintenance/archives/patch-oldimage-oi_description_id.sql b/maintenance/archives/patch-oldimage-oi_description_id.sql
new file mode 100644 (file)
index 0000000..be24a80
--- /dev/null
@@ -0,0 +1,3 @@
+ALTER TABLE /*_*/oldimage
+  ALTER COLUMN oi_description SET DEFAULT '',
+  ADD COLUMN oi_description_id bigint unsigned NOT NULL DEFAULT 0 AFTER oi_description;
diff --git a/maintenance/archives/patch-protected_titles-pt_reason_id.sql b/maintenance/archives/patch-protected_titles-pt_reason_id.sql
new file mode 100644 (file)
index 0000000..02efd2f
--- /dev/null
@@ -0,0 +1,3 @@
+ALTER TABLE /*_*/protected_titles
+  ALTER COLUMN pt_reason SET DEFAULT '',
+  ADD COLUMN pt_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER pt_reason;
diff --git a/maintenance/archives/patch-recentchanges-rc_comment_id.sql b/maintenance/archives/patch-recentchanges-rc_comment_id.sql
new file mode 100644 (file)
index 0000000..38bff08
--- /dev/null
@@ -0,0 +1,2 @@
+ALTER TABLE /*_*/recentchanges
+  ADD COLUMN rc_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER rc_comment;
diff --git a/maintenance/archives/patch-revision-rev_comment-default.sql b/maintenance/archives/patch-revision-rev_comment-default.sql
new file mode 100644 (file)
index 0000000..2beedcc
--- /dev/null
@@ -0,0 +1,2 @@
+ALTER TABLE /*_*/revision
+  ALTER COLUMN rev_comment SET DEFAULT '';
diff --git a/maintenance/archives/patch-revision_comment_temp-table.sql b/maintenance/archives/patch-revision_comment_temp-table.sql
new file mode 100644 (file)
index 0000000..689e5d5
--- /dev/null
@@ -0,0 +1,6 @@
+CREATE TABLE /*_*/revision_comment_temp (
+  revcomment_rev int unsigned NOT NULL,
+  revcomment_comment_id bigint unsigned NOT NULL,
+  PRIMARY KEY (revcomment_rev, revcomment_comment_id)
+) /*$wgDBTableOptions*/;
+CREATE UNIQUE INDEX /*i*/revcomment_rev ON /*_*/revision_comment_temp (revcomment_rev);
index 243a3b3..4b91815 100644 (file)
@@ -1,7 +1,7 @@
 --
 -- patch-comment-table.sql
 --
--- T166732. Add a `comment` table, and temporary tables to reference it.
+-- T166732. Add a `comment` table
 
 CREATE SEQUENCE comment_comment_id_seq;
 CREATE TABLE comment (
@@ -11,17 +11,3 @@ CREATE TABLE comment (
        comment_data TEXT
 );
 CREATE INDEX comment_hash ON comment (comment_hash);
-
-CREATE TABLE revision_comment_temp (
-       revcomment_rev        INTEGER NOT NULL,
-       revcomment_comment_id INTEGER NOT NULL,
-       PRIMARY KEY (revcomment_rev, revcomment_comment_id)
-);
-CREATE UNIQUE INDEX revcomment_rev ON revision_comment_temp (revcomment_rev);
-
-CREATE TABLE image_comment_temp (
-       imgcomment_name       TEXT NOT NULL,
-       imgcomment_description_id INTEGER NOT NULL,
-       PRIMARY KEY (imgcomment_name, imgcomment_description_id)
-);
-CREATE UNIQUE INDEX imgcomment_name ON image_comment_temp (imgcomment_name);
diff --git a/maintenance/postgres/archives/patch-image_comment_temp-table.sql b/maintenance/postgres/archives/patch-image_comment_temp-table.sql
new file mode 100644 (file)
index 0000000..be7bb82
--- /dev/null
@@ -0,0 +1,6 @@
+CREATE TABLE image_comment_temp (
+       imgcomment_name       TEXT NOT NULL,
+       imgcomment_description_id INTEGER NOT NULL,
+       PRIMARY KEY (imgcomment_name, imgcomment_description_id)
+);
+CREATE UNIQUE INDEX imgcomment_name ON image_comment_temp (imgcomment_name);
diff --git a/maintenance/postgres/archives/patch-revision_comment_temp-table.sql b/maintenance/postgres/archives/patch-revision_comment_temp-table.sql
new file mode 100644 (file)
index 0000000..cbfaa06
--- /dev/null
@@ -0,0 +1,6 @@
+CREATE TABLE revision_comment_temp (
+       revcomment_rev        INTEGER NOT NULL,
+       revcomment_comment_id INTEGER NOT NULL,
+       PRIMARY KEY (revcomment_rev, revcomment_comment_id)
+);
+CREATE UNIQUE INDEX revcomment_rev ON revision_comment_temp (revcomment_rev);
diff --git a/maintenance/sqlite/archives/patch-archive-ar_comment_id.sql b/maintenance/sqlite/archives/patch-archive-ar_comment_id.sql
new file mode 100644 (file)
index 0000000..d06b81c
--- /dev/null
@@ -0,0 +1,46 @@
+BEGIN;
+
+DROP TABLE IF EXISTS /*_*/archive_tmp;
+CREATE TABLE /*_*/archive_tmp (
+  ar_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
+  ar_namespace int NOT NULL default 0,
+  ar_title varchar(255) binary NOT NULL default '',
+  ar_text mediumblob NOT NULL,
+  ar_comment varbinary(767) NOT NULL default '',
+  ar_comment_id bigint unsigned NOT NULL DEFAULT 0,
+  ar_user int unsigned NOT NULL default 0,
+  ar_user_text varchar(255) binary NOT NULL,
+  ar_timestamp binary(14) NOT NULL default '',
+  ar_minor_edit tinyint NOT NULL default 0,
+  ar_flags tinyblob NOT NULL,
+  ar_rev_id int unsigned,
+  ar_text_id int unsigned,
+  ar_deleted tinyint unsigned NOT NULL default 0,
+  ar_len int unsigned,
+  ar_page_id int unsigned,
+  ar_parent_id int unsigned default NULL,
+  ar_sha1 varbinary(32) NOT NULL default '',
+  ar_content_model varbinary(32) DEFAULT NULL,
+  ar_content_format varbinary(64) DEFAULT NULL
+) /*$wgDBTableOptions*/;
+
+INSERT OR IGNORE INTO /*_*/archive_tmp (
+       ar_id, ar_namespace, ar_title, ar_text, ar_comment, ar_user, ar_user_text,
+       ar_timestamp, ar_minor_edit, ar_flags, ar_rev_id, ar_text_id, ar_deleted,
+       ar_len, ar_page_id, ar_parent_id, ar_sha1, ar_content_model,
+       ar_content_format)
+  SELECT
+       ar_id, ar_namespace, ar_title, ar_text, ar_comment, ar_user, ar_user_text,
+       ar_timestamp, ar_minor_edit, ar_flags, ar_rev_id, ar_text_id, ar_deleted,
+       ar_len, ar_page_id, ar_parent_id, ar_sha1, ar_content_model,
+       ar_content_format
+  FROM /*_*/archive;
+
+DROP TABLE /*_*/archive;
+ALTER TABLE /*_*/archive_tmp RENAME TO /*_*/archive;
+CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp);
+CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp);
+CREATE INDEX /*i*/ar_revid ON /*_*/archive (ar_rev_id);
+
+COMMIT;
+
diff --git a/maintenance/sqlite/archives/patch-comment-table.sql b/maintenance/sqlite/archives/patch-comment-table.sql
deleted file mode 100644 (file)
index d74c3a6..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
---
--- patch-comment-table.sql
---
--- T166732. Add a `comment` table and various columns (and temporary tables) to reference it.
--- Sigh, sqlite, such trouble just to change the default value of a column.
-
-CREATE TABLE /*_*/comment (
-  comment_id bigint unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-  comment_hash INT NOT NULL,
-  comment_text BLOB NOT NULL,
-  comment_data BLOB
-) /*$wgDBTableOptions*/;
-CREATE INDEX /*i*/comment_hash ON /*_*/comment (comment_hash);
-
-CREATE TABLE /*_*/revision_comment_temp (
-  revcomment_rev int unsigned NOT NULL,
-  revcomment_comment_id bigint unsigned NOT NULL,
-  PRIMARY KEY (revcomment_rev, revcomment_comment_id)
-) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/revcomment_rev ON /*_*/revision_comment_temp (revcomment_rev);
-
-CREATE TABLE /*_*/image_comment_temp (
-  imgcomment_name varchar(255) binary NOT NULL,
-  imgcomment_description_id bigint unsigned NOT NULL,
-  PRIMARY KEY (imgcomment_name, imgcomment_description_id)
-) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/imgcomment_name ON /*_*/image_comment_temp (imgcomment_name);
-
-ALTER TABLE /*_*/recentchanges
-  ADD COLUMN rc_comment_id bigint unsigned NOT NULL DEFAULT 0;
-
-ALTER TABLE /*_*/logging
-  ADD COLUMN log_comment_id bigint unsigned NOT NULL DEFAULT 0;
-
-BEGIN;
-
-DROP TABLE IF EXISTS /*_*/revision_tmp;
-CREATE TABLE /*_*/revision_tmp (
-  rev_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-  rev_page int unsigned NOT NULL,
-  rev_text_id int unsigned NOT NULL,
-  rev_comment varbinary(767) NOT NULL default '',
-  rev_user int unsigned NOT NULL default 0,
-  rev_user_text varchar(255) binary NOT NULL default '',
-  rev_timestamp binary(14) NOT NULL default '',
-  rev_minor_edit tinyint unsigned NOT NULL default 0,
-  rev_deleted tinyint unsigned NOT NULL default 0,
-  rev_len int unsigned,
-  rev_parent_id int unsigned default NULL,
-  rev_sha1 varbinary(32) NOT NULL default '',
-  rev_content_model varbinary(32) DEFAULT NULL,
-  rev_content_format varbinary(64) DEFAULT NULL
-) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=1024;
-
-INSERT OR IGNORE INTO /*_*/revision_tmp (
-       rev_id, rev_page, rev_text_id, rev_comment, rev_user, rev_user_text,
-       rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id,
-       rev_sha1, rev_content_model, rev_content_format)
- SELECT
-       rev_id, rev_page, rev_text_id, rev_comment, rev_user, rev_user_text,
-       rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id,
-       rev_sha1, rev_content_model, rev_content_format
-  FROM /*_*/revision;
-
-DROP TABLE /*_*/revision;
-ALTER TABLE /*_*/revision_tmp RENAME TO /*_*/revision;
-CREATE INDEX /*i*/rev_page_id ON /*_*/revision (rev_page, rev_id);
-CREATE INDEX /*i*/rev_timestamp ON /*_*/revision (rev_timestamp);
-CREATE INDEX /*i*/page_timestamp ON /*_*/revision (rev_page,rev_timestamp);
-CREATE INDEX /*i*/user_timestamp ON /*_*/revision (rev_user,rev_timestamp);
-CREATE INDEX /*i*/usertext_timestamp ON /*_*/revision (rev_user_text,rev_timestamp);
-CREATE INDEX /*i*/page_user_timestamp ON /*_*/revision (rev_page,rev_user,rev_timestamp);
-
-COMMIT;
-
-BEGIN;
-
-DROP TABLE IF EXISTS /*_*/archive_tmp;
-CREATE TABLE /*_*/archive_tmp (
-  ar_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-  ar_namespace int NOT NULL default 0,
-  ar_title varchar(255) binary NOT NULL default '',
-  ar_text mediumblob NOT NULL,
-  ar_comment varbinary(767) NOT NULL default '',
-  ar_comment_id bigint unsigned NOT NULL DEFAULT 0,
-  ar_user int unsigned NOT NULL default 0,
-  ar_user_text varchar(255) binary NOT NULL,
-  ar_timestamp binary(14) NOT NULL default '',
-  ar_minor_edit tinyint NOT NULL default 0,
-  ar_flags tinyblob NOT NULL,
-  ar_rev_id int unsigned,
-  ar_text_id int unsigned,
-  ar_deleted tinyint unsigned NOT NULL default 0,
-  ar_len int unsigned,
-  ar_page_id int unsigned,
-  ar_parent_id int unsigned default NULL,
-  ar_sha1 varbinary(32) NOT NULL default '',
-  ar_content_model varbinary(32) DEFAULT NULL,
-  ar_content_format varbinary(64) DEFAULT NULL
-) /*$wgDBTableOptions*/;
-
-INSERT OR IGNORE INTO /*_*/archive_tmp (
-       ar_id, ar_namespace, ar_title, ar_text, ar_comment, ar_user, ar_user_text,
-       ar_timestamp, ar_minor_edit, ar_flags, ar_rev_id, ar_text_id, ar_deleted,
-       ar_len, ar_page_id, ar_parent_id, ar_sha1, ar_content_model,
-       ar_content_format)
-  SELECT
-       ar_id, ar_namespace, ar_title, ar_text, ar_comment, ar_user, ar_user_text,
-       ar_timestamp, ar_minor_edit, ar_flags, ar_rev_id, ar_text_id, ar_deleted,
-       ar_len, ar_page_id, ar_parent_id, ar_sha1, ar_content_model,
-       ar_content_format
-  FROM /*_*/archive;
-
-DROP TABLE /*_*/archive;
-ALTER TABLE /*_*/archive_tmp RENAME TO /*_*/archive;
-CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp);
-CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp);
-CREATE INDEX /*i*/ar_revid ON /*_*/archive (ar_rev_id);
-
-COMMIT;
-
-BEGIN;
-
-DROP TABLE IF EXISTS ipblocks_tmp;
-CREATE TABLE /*_*/ipblocks_tmp (
-  ipb_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
-  ipb_address tinyblob NOT NULL,
-  ipb_user int unsigned NOT NULL default 0,
-  ipb_by int unsigned NOT NULL default 0,
-  ipb_by_text varchar(255) binary NOT NULL default '',
-  ipb_reason varbinary(767) NOT NULL default '',
-  ipb_reason_id bigint unsigned NOT NULL DEFAULT 0,
-  ipb_timestamp binary(14) NOT NULL default '',
-  ipb_auto bool NOT NULL default 0,
-  ipb_anon_only bool NOT NULL default 0,
-  ipb_create_account bool NOT NULL default 1,
-  ipb_enable_autoblock bool NOT NULL default '1',
-  ipb_expiry varbinary(14) NOT NULL default '',
-  ipb_range_start tinyblob NOT NULL,
-  ipb_range_end tinyblob NOT NULL,
-  ipb_deleted bool NOT NULL default 0,
-  ipb_block_email bool NOT NULL default 0,
-  ipb_allow_usertalk bool NOT NULL default 0,
-  ipb_parent_block_id int default NULL
-) /*$wgDBTableOptions*/;
-
-INSERT OR IGNORE INTO /*_*/ipblocks_tmp (
-       ipb_id, ipb_address, ipb_user, ipb_by, ipb_by_text, ipb_reason,
-       ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account,
-       ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end,
-       ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id)
-  SELECT
-       ipb_id, ipb_address, ipb_user, ipb_by, ipb_by_text, ipb_reason,
-       ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account,
-       ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end,
-       ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id
-  FROM /*_*/ipblocks;
-
-DROP TABLE /*_*/ipblocks;
-ALTER TABLE /*_*/ipblocks_tmp RENAME TO /*_*/ipblocks;
-CREATE UNIQUE INDEX /*i*/ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only);
-CREATE INDEX /*i*/ipb_user ON /*_*/ipblocks (ipb_user);
-CREATE INDEX /*i*/ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8));
-CREATE INDEX /*i*/ipb_timestamp ON /*_*/ipblocks (ipb_timestamp);
-CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks (ipb_expiry);
-CREATE INDEX /*i*/ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id);
-
-COMMIT;
-
-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_user int unsigned NOT NULL default 0,
-  img_user_text varchar(255) binary NOT NULL,
-  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;
-
-BEGIN;
-
-DROP TABLE IF EXISTS /*_*/oldimage_tmp;
-CREATE TABLE /*_*/oldimage_tmp (
-  oi_name varchar(255) binary NOT NULL default '',
-  oi_archive_name varchar(255) binary NOT NULL default '',
-  oi_size int unsigned NOT NULL default 0,
-  oi_width int NOT NULL default 0,
-  oi_height int NOT NULL default 0,
-  oi_bits int NOT NULL default 0,
-  oi_description varbinary(767) NOT NULL default '',
-  oi_description_id bigint unsigned NOT NULL DEFAULT 0,
-  oi_user int unsigned NOT NULL default 0,
-  oi_user_text varchar(255) binary NOT NULL,
-  oi_timestamp binary(14) NOT NULL default '',
-  oi_metadata mediumblob NOT NULL,
-  oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL,
-  oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown",
-  oi_minor_mime varbinary(100) NOT NULL default "unknown",
-  oi_deleted tinyint unsigned NOT NULL default 0,
-  oi_sha1 varbinary(32) NOT NULL default ''
-) /*$wgDBTableOptions*/;
-
-INSERT OR IGNORE INTO /*_*/oldimage_tmp (
-       oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits,
-       oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata,
-       oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1)
-  SELECT
-       oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits,
-       oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata,
-       oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1
-  FROM /*_*/oldimage;
-
-DROP TABLE /*_*/oldimage;
-ALTER TABLE /*_*/oldimage_tmp RENAME TO /*_*/oldimage;
-CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp);
-CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp);
-CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14));
-CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1(10));
-
-COMMIT;
-
--- filearchive is done in patch-filearchive-fa_description_id.sql
-
-BEGIN;
-
-DROP TABLE IF EXISTS /*_*/protected_titles_tmp;
-CREATE TABLE /*_*/protected_titles_tmp (
-  pt_namespace int NOT NULL,
-  pt_title varchar(255) binary NOT NULL,
-  pt_user int unsigned NOT NULL,
-  pt_reason varbinary(767) default '',
-  pt_reason_id bigint unsigned NOT NULL DEFAULT 0,
-  pt_timestamp binary(14) NOT NULL,
-  pt_expiry varbinary(14) NOT NULL default '',
-  pt_create_perm varbinary(60) NOT NULL
-) /*$wgDBTableOptions*/;
-
-INSERT OR IGNORE INTO /*_*/protected_titles_tmp (
-       pt_namespace, pt_title, pt_user, pt_reason, pt_timestamp, pt_expiry, pt_create_perm)
-  SELECT
-       pt_namespace, pt_title, pt_user, pt_reason, pt_timestamp, pt_expiry, pt_create_perm
-  FROM /*_*/protected_titles;
-
-DROP TABLE /*_*/protected_titles;
-ALTER TABLE /*_*/protected_titles_tmp RENAME TO /*_*/protected_titles;
-CREATE UNIQUE INDEX /*i*/pt_namespace_title ON /*_*/protected_titles (pt_namespace,pt_title);
-CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles (pt_timestamp);
-
-COMMIT;
diff --git a/maintenance/sqlite/archives/patch-image-img_description-default.sql b/maintenance/sqlite/archives/patch-image-img_description-default.sql
new file mode 100644 (file)
index 0000000..b810ed5
--- /dev/null
@@ -0,0 +1,40 @@
+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_user int unsigned NOT NULL default 0,
+  img_user_text varchar(255) binary NOT NULL,
+  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;
diff --git a/maintenance/sqlite/archives/patch-ipblocks-ipb_reason_id.sql b/maintenance/sqlite/archives/patch-ipblocks-ipb_reason_id.sql
new file mode 100644 (file)
index 0000000..b1079fc
--- /dev/null
@@ -0,0 +1,47 @@
+BEGIN;
+
+DROP TABLE IF EXISTS ipblocks_tmp;
+CREATE TABLE /*_*/ipblocks_tmp (
+  ipb_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
+  ipb_address tinyblob NOT NULL,
+  ipb_user int unsigned NOT NULL default 0,
+  ipb_by int unsigned NOT NULL default 0,
+  ipb_by_text varchar(255) binary NOT NULL default '',
+  ipb_reason varbinary(767) NOT NULL default '',
+  ipb_reason_id bigint unsigned NOT NULL DEFAULT 0,
+  ipb_timestamp binary(14) NOT NULL default '',
+  ipb_auto bool NOT NULL default 0,
+  ipb_anon_only bool NOT NULL default 0,
+  ipb_create_account bool NOT NULL default 1,
+  ipb_enable_autoblock bool NOT NULL default '1',
+  ipb_expiry varbinary(14) NOT NULL default '',
+  ipb_range_start tinyblob NOT NULL,
+  ipb_range_end tinyblob NOT NULL,
+  ipb_deleted bool NOT NULL default 0,
+  ipb_block_email bool NOT NULL default 0,
+  ipb_allow_usertalk bool NOT NULL default 0,
+  ipb_parent_block_id int default NULL
+) /*$wgDBTableOptions*/;
+
+INSERT OR IGNORE INTO /*_*/ipblocks_tmp (
+       ipb_id, ipb_address, ipb_user, ipb_by, ipb_by_text, ipb_reason,
+       ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account,
+       ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end,
+       ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id)
+  SELECT
+       ipb_id, ipb_address, ipb_user, ipb_by, ipb_by_text, ipb_reason,
+       ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account,
+       ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end,
+       ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id
+  FROM /*_*/ipblocks;
+
+DROP TABLE /*_*/ipblocks;
+ALTER TABLE /*_*/ipblocks_tmp RENAME TO /*_*/ipblocks;
+CREATE UNIQUE INDEX /*i*/ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only);
+CREATE INDEX /*i*/ipb_user ON /*_*/ipblocks (ipb_user);
+CREATE INDEX /*i*/ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8));
+CREATE INDEX /*i*/ipb_timestamp ON /*_*/ipblocks (ipb_timestamp);
+CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks (ipb_expiry);
+CREATE INDEX /*i*/ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id);
+
+COMMIT;
diff --git a/maintenance/sqlite/archives/patch-logging-log_comment_id.sql b/maintenance/sqlite/archives/patch-logging-log_comment_id.sql
new file mode 100644 (file)
index 0000000..784a88d
--- /dev/null
@@ -0,0 +1,2 @@
+ALTER TABLE /*_*/logging
+  ADD COLUMN log_comment_id bigint unsigned NOT NULL DEFAULT 0;
diff --git a/maintenance/sqlite/archives/patch-oldimage-oi_description_id.sql b/maintenance/sqlite/archives/patch-oldimage-oi_description_id.sql
new file mode 100644 (file)
index 0000000..c0191a7
--- /dev/null
@@ -0,0 +1,41 @@
+BEGIN;
+
+DROP TABLE IF EXISTS /*_*/oldimage_tmp;
+CREATE TABLE /*_*/oldimage_tmp (
+  oi_name varchar(255) binary NOT NULL default '',
+  oi_archive_name varchar(255) binary NOT NULL default '',
+  oi_size int unsigned NOT NULL default 0,
+  oi_width int NOT NULL default 0,
+  oi_height int NOT NULL default 0,
+  oi_bits int NOT NULL default 0,
+  oi_description varbinary(767) NOT NULL default '',
+  oi_description_id bigint unsigned NOT NULL DEFAULT 0,
+  oi_user int unsigned NOT NULL default 0,
+  oi_user_text varchar(255) binary NOT NULL,
+  oi_timestamp binary(14) NOT NULL default '',
+  oi_metadata mediumblob NOT NULL,
+  oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL,
+  oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown",
+  oi_minor_mime varbinary(100) NOT NULL default "unknown",
+  oi_deleted tinyint unsigned NOT NULL default 0,
+  oi_sha1 varbinary(32) NOT NULL default ''
+) /*$wgDBTableOptions*/;
+
+INSERT OR IGNORE INTO /*_*/oldimage_tmp (
+       oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits,
+       oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata,
+       oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1)
+  SELECT
+       oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits,
+       oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata,
+       oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1
+  FROM /*_*/oldimage;
+
+DROP TABLE /*_*/oldimage;
+ALTER TABLE /*_*/oldimage_tmp RENAME TO /*_*/oldimage;
+CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp);
+CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp);
+CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14));
+CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1(10));
+
+COMMIT;
diff --git a/maintenance/sqlite/archives/patch-protected_titles-pt_reason_id.sql b/maintenance/sqlite/archives/patch-protected_titles-pt_reason_id.sql
new file mode 100644 (file)
index 0000000..793144c
--- /dev/null
@@ -0,0 +1,26 @@
+BEGIN;
+
+DROP TABLE IF EXISTS /*_*/protected_titles_tmp;
+CREATE TABLE /*_*/protected_titles_tmp (
+  pt_namespace int NOT NULL,
+  pt_title varchar(255) binary NOT NULL,
+  pt_user int unsigned NOT NULL,
+  pt_reason varbinary(767) default '',
+  pt_reason_id bigint unsigned NOT NULL DEFAULT 0,
+  pt_timestamp binary(14) NOT NULL,
+  pt_expiry varbinary(14) NOT NULL default '',
+  pt_create_perm varbinary(60) NOT NULL
+) /*$wgDBTableOptions*/;
+
+INSERT OR IGNORE INTO /*_*/protected_titles_tmp (
+       pt_namespace, pt_title, pt_user, pt_reason, pt_timestamp, pt_expiry, pt_create_perm)
+  SELECT
+       pt_namespace, pt_title, pt_user, pt_reason, pt_timestamp, pt_expiry, pt_create_perm
+  FROM /*_*/protected_titles;
+
+DROP TABLE /*_*/protected_titles;
+ALTER TABLE /*_*/protected_titles_tmp RENAME TO /*_*/protected_titles;
+CREATE UNIQUE INDEX /*i*/pt_namespace_title ON /*_*/protected_titles (pt_namespace,pt_title);
+CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles (pt_timestamp);
+
+COMMIT;
diff --git a/maintenance/sqlite/archives/patch-recentchanges-rc_comment_id.sql b/maintenance/sqlite/archives/patch-recentchanges-rc_comment_id.sql
new file mode 100644 (file)
index 0000000..55bf9b5
--- /dev/null
@@ -0,0 +1,2 @@
+ALTER TABLE /*_*/recentchanges
+  ADD COLUMN rc_comment_id bigint unsigned NOT NULL DEFAULT 0;
diff --git a/maintenance/sqlite/archives/patch-revision-rev_comment-default.sql b/maintenance/sqlite/archives/patch-revision-rev_comment-default.sql
new file mode 100644 (file)
index 0000000..0194079
--- /dev/null
@@ -0,0 +1,40 @@
+BEGIN;
+
+DROP TABLE IF EXISTS /*_*/revision_tmp;
+CREATE TABLE /*_*/revision_tmp (
+  rev_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
+  rev_page int unsigned NOT NULL,
+  rev_text_id int unsigned NOT NULL,
+  rev_comment varbinary(767) NOT NULL default '',
+  rev_user int unsigned NOT NULL default 0,
+  rev_user_text varchar(255) binary NOT NULL default '',
+  rev_timestamp binary(14) NOT NULL default '',
+  rev_minor_edit tinyint unsigned NOT NULL default 0,
+  rev_deleted tinyint unsigned NOT NULL default 0,
+  rev_len int unsigned,
+  rev_parent_id int unsigned default NULL,
+  rev_sha1 varbinary(32) NOT NULL default '',
+  rev_content_model varbinary(32) DEFAULT NULL,
+  rev_content_format varbinary(64) DEFAULT NULL
+) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=1024;
+
+INSERT OR IGNORE INTO /*_*/revision_tmp (
+       rev_id, rev_page, rev_text_id, rev_comment, rev_user, rev_user_text,
+       rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id,
+       rev_sha1, rev_content_model, rev_content_format)
+ SELECT
+       rev_id, rev_page, rev_text_id, rev_comment, rev_user, rev_user_text,
+       rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id,
+       rev_sha1, rev_content_model, rev_content_format
+  FROM /*_*/revision;
+
+DROP TABLE /*_*/revision;
+ALTER TABLE /*_*/revision_tmp RENAME TO /*_*/revision;
+CREATE INDEX /*i*/rev_page_id ON /*_*/revision (rev_page, rev_id);
+CREATE INDEX /*i*/rev_timestamp ON /*_*/revision (rev_timestamp);
+CREATE INDEX /*i*/page_timestamp ON /*_*/revision (rev_page,rev_timestamp);
+CREATE INDEX /*i*/user_timestamp ON /*_*/revision (rev_user,rev_timestamp);
+CREATE INDEX /*i*/usertext_timestamp ON /*_*/revision (rev_user_text,rev_timestamp);
+CREATE INDEX /*i*/page_user_timestamp ON /*_*/revision (rev_page,rev_user,rev_timestamp);
+
+COMMIT;