aboutsummaryrefslogtreecommitdiffstats
path: root/sql/sqlite
diff options
context:
space:
mode:
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>2024-12-13 14:54:36 +0000
committerGerrit Code Review <gerrit@wikimedia.org>2024-12-13 14:54:36 +0000
commit2d8285583f1866a0b00ec4df8365fb5fc63e0072 (patch)
tree6375b9e4e1001936f3259f7f4674bfbad369b080 /sql/sqlite
parenta42ef21f4f2fed3f76214568c4c9b91bd45435e6 (diff)
parent251f4395865f8a33bcf32c6faa11748a14753492 (diff)
downloadmediawikicore-2d8285583f1866a0b00ec4df8365fb5fc63e0072.tar.gz
mediawikicore-2d8285583f1866a0b00ec4df8365fb5fc63e0072.zip
Merge "Move SQL schema and schema changes to new sql/ top-level directory"
Diffstat (limited to 'sql/sqlite')
-rw-r--r--sql/sqlite/patch-archive-ar_title-varbinary.sql29
-rw-r--r--sql/sqlite/patch-archive-rename-name_title_timestamp-index.sql2
-rw-r--r--sql/sqlite/patch-block_target.sql41
-rw-r--r--sql/sqlite/patch-category-cat_title-varbinary.sql15
-rw-r--r--sql/sqlite/patch-categorylinks-cl_to-varbinary.sql28
-rw-r--r--sql/sqlite/patch-change_tag-ct_rc_id.sql17
-rw-r--r--sql/sqlite/patch-change_tag-rename-indexes.sql21
-rw-r--r--sql/sqlite/patch-content-content_id-fix_not_null.sql13
-rw-r--r--sql/sqlite/patch-content_models-model_id-fix_not_null.sql11
-rw-r--r--sql/sqlite/patch-drop-cl_collation_ext.sql48
-rw-r--r--sql/sqlite/patch-drop-page_restrictions-pr_user.sql21
-rw-r--r--sql/sqlite/patch-drop-rev_page_id.sql22
-rw-r--r--sql/sqlite/patch-externallinks-drop-el_to.sql15
-rw-r--r--sql/sqlite/patch-externallinks-el_to_default.sql19
-rw-r--r--sql/sqlite/patch-externallinks-el_to_path.sql24
-rw-r--r--sql/sqlite/patch-filearchive-fa_name.sql41
-rw-r--r--sql/sqlite/patch-filearchive-fa_size_to_bigint.sql18
-rw-r--r--sql/sqlite/patch-image-img_name-varbinary.sql35
-rw-r--r--sql/sqlite/patch-image-img_size_to_bigint.sql18
-rw-r--r--sql/sqlite/patch-imagelinks-il_to-varbinary.sql18
-rw-r--r--sql/sqlite/patch-ip_changes-pc_rev_timestamp-drop-default.sql17
-rw-r--r--sql/sqlite/patch-ipblocks-ipb_id.sql25
-rw-r--r--sql/sqlite/patch-ipblocks-ipb_timestamp-drop-default.sql45
-rw-r--r--sql/sqlite/patch-ipblocks_restrictions-ir_ipb_id.sql15
-rw-r--r--sql/sqlite/patch-ipblocks_restrictions-ir_value.sql15
-rw-r--r--sql/sqlite/patch-iwlinks-drop-iwl_prefix_from_title.sql29
-rw-r--r--sql/sqlite/patch-iwlinks-iwl_title-varbinary.sql16
-rw-r--r--sql/sqlite/patch-job-job_title-varbinary.sql15
-rw-r--r--sql/sqlite/patch-langlinks-ll_title-varbinary.sql14
-rw-r--r--sql/sqlite/patch-linktarget.sql6
-rw-r--r--sql/sqlite/patch-logging-log_title-varbinary.sql42
-rw-r--r--sql/sqlite/patch-logging-rename-indexes.sql27
-rw-r--r--sql/sqlite/patch-objectcache-exptime-notnull.sql14
-rw-r--r--sql/sqlite/patch-objectcache-modtoken.sql8
-rw-r--r--sql/sqlite/patch-oldimage-oi_name-varbinary.sql28
-rw-r--r--sql/sqlite/patch-oldimage-oi_size_to_bigint.sql18
-rw-r--r--sql/sqlite/patch-oldimage-oi_timestamp.sql22
-rw-r--r--sql/sqlite/patch-page-drop-page_restrictions.sql21
-rw-r--r--sql/sqlite/patch-page-page_title-varbinary.sql33
-rw-r--r--sql/sqlite/patch-page-rename-name_title-index.sql21
-rw-r--r--sql/sqlite/patch-page_props-pp_page.sql17
-rw-r--r--sql/sqlite/patch-page_restrictions-pr_page.sql21
-rw-r--r--sql/sqlite/patch-pagelinks-drop-pl_title.sql36
-rw-r--r--sql/sqlite/patch-pagelinks-pl_title-varbinary.sql19
-rw-r--r--sql/sqlite/patch-pagelinks-target_id.sql17
-rw-r--r--sql/sqlite/patch-protected_titles-pt_expiry-drop-default.sql19
-rw-r--r--sql/sqlite/patch-protected_titles-pt_title-varbinary.sql19
-rw-r--r--sql/sqlite/patch-querycache-qc_title-varbinary.sql14
-rw-r--r--sql/sqlite/patch-querycachetwo-qcc_title-varbinary.sql24
-rw-r--r--sql/sqlite/patch-recentchanges-rc_new_name_timestamp.sql31
-rw-r--r--sql/sqlite/patch-recentchanges-rc_title-varbinary.sql48
-rw-r--r--sql/sqlite/patch-redirect-rd_title-varbinary.sql15
-rw-r--r--sql/sqlite/patch-revision-cleanup.sql61
-rw-r--r--sql/sqlite/patch-revision-rename-index.sql23
-rw-r--r--sql/sqlite/patch-revision-rev_timestamp-drop-default.sql26
-rw-r--r--sql/sqlite/patch-site_identifiers-rename-indexes.sql17
-rw-r--r--sql/sqlite/patch-sites-drop_indexes.sql57
-rw-r--r--sql/sqlite/patch-sites-rename-indexes.sql29
-rw-r--r--sql/sqlite/patch-slot_roles-role_id-fix_not_null.sql11
-rw-r--r--sql/sqlite/patch-templatelinks-drop-tl_title.sql19
-rw-r--r--sql/sqlite/patch-templatelinks-target_id.sql19
-rw-r--r--sql/sqlite/patch-templatelinks-tl_title-nullable.sql21
-rw-r--r--sql/sqlite/patch-templatelinks-tl_title-varbinary.sql20
-rw-r--r--sql/sqlite/patch-uploadstash-us_size_to_bigint.sql16
-rw-r--r--sql/sqlite/patch-user-user_editcount.sql19
-rw-r--r--sql/sqlite/patch-user-user_is_temp.sql6
-rw-r--r--sql/sqlite/patch-user_autocreate_serial-uas_year.sql25
-rw-r--r--sql/sqlite/patch-user_autocreate_serial.sql5
-rw-r--r--sql/sqlite/patch-user_properties-rename-index.sql15
-rw-r--r--sql/sqlite/patch-user_table-updates.sql19
-rw-r--r--sql/sqlite/patch-watchlist-namespace_title-rename-index.sql19
-rw-r--r--sql/sqlite/patch-watchlist-wl_title-varbinary.sql21
-rw-r--r--sql/sqlite/searchindex-fts3.sql18
-rw-r--r--sql/sqlite/searchindex-no-fts.sql23
-rw-r--r--sql/sqlite/tables-generated.sql871
75 files changed, 2527 insertions, 0 deletions
diff --git a/sql/sqlite/patch-archive-ar_title-varbinary.sql b/sql/sqlite/patch-archive-ar_title-varbinary.sql
new file mode 100644
index 000000000000..a0e4208066dc
--- /dev/null
+++ b/sql/sqlite/patch-archive-ar_title-varbinary.sql
@@ -0,0 +1,29 @@
+CREATE TABLE archive_tmp (
+ ar_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ ar_namespace INTEGER DEFAULT 0 NOT NULL,
+ ar_title BLOB DEFAULT '' NOT NULL, ar_comment_id BIGINT UNSIGNED NOT NULL,
+ ar_actor BIGINT UNSIGNED NOT NULL,
+ ar_timestamp BLOB NOT NULL, ar_minor_edit SMALLINT DEFAULT 0 NOT NULL,
+ ar_rev_id INTEGER UNSIGNED NOT NULL,
+ ar_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ ar_len INTEGER UNSIGNED DEFAULT NULL,
+ ar_page_id INTEGER UNSIGNED DEFAULT NULL,
+ ar_parent_id INTEGER UNSIGNED DEFAULT NULL,
+ ar_sha1 BLOB DEFAULT '' NOT NULL
+);
+INSERT INTO /*_*/archive_tmp (
+ ar_id, ar_namespace, ar_title, ar_comment_id, ar_actor, ar_timestamp, ar_minor_edit, ar_rev_id,
+ ar_deleted, ar_len, ar_page_id, ar_parent_id, ar_sha1)
+SELECT ar_id, ar_namespace, ar_title, ar_comment_id, ar_actor, ar_timestamp, ar_minor_edit, ar_rev_id, ar_deleted,
+ ar_len, ar_page_id, ar_parent_id, ar_sha1
+FROM /*_*/archive;
+DROP TABLE /*_*/archive;
+ALTER TABLE /*_*/archive_tmp RENAME TO /*_*/archive;
+
+CREATE INDEX ar_name_title_timestamp ON /*_*/archive (
+ ar_namespace, ar_title, ar_timestamp
+);
+
+CREATE INDEX ar_actor_timestamp ON /*_*/archive (ar_actor, ar_timestamp);
+
+CREATE UNIQUE INDEX ar_revid_uniq ON /*_*/archive (ar_rev_id);
diff --git a/sql/sqlite/patch-archive-rename-name_title_timestamp-index.sql b/sql/sqlite/patch-archive-rename-name_title_timestamp-index.sql
new file mode 100644
index 000000000000..accce740c0f2
--- /dev/null
+++ b/sql/sqlite/patch-archive-rename-name_title_timestamp-index.sql
@@ -0,0 +1,2 @@
+DROP INDEX name_title_timestamp;
+CREATE INDEX ar_name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp);
diff --git a/sql/sqlite/patch-block_target.sql b/sql/sqlite/patch-block_target.sql
new file mode 100644
index 000000000000..b77254995bd0
--- /dev/null
+++ b/sql/sqlite/patch-block_target.sql
@@ -0,0 +1,41 @@
+
+CREATE TABLE /*_*/block (
+ bl_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ bl_target INTEGER UNSIGNED NOT NULL,
+ bl_by_actor BIGINT UNSIGNED NOT NULL,
+ bl_reason_id BIGINT UNSIGNED NOT NULL,
+ bl_timestamp BLOB NOT NULL, bl_anon_only SMALLINT DEFAULT 0 NOT NULL,
+ bl_create_account SMALLINT DEFAULT 1 NOT NULL,
+ bl_enable_autoblock SMALLINT DEFAULT 1 NOT NULL,
+ bl_expiry BLOB NOT NULL, bl_deleted SMALLINT DEFAULT 0 NOT NULL,
+ bl_block_email SMALLINT DEFAULT 0 NOT NULL,
+ bl_allow_usertalk SMALLINT DEFAULT 0 NOT NULL,
+ bl_parent_block_id INTEGER UNSIGNED DEFAULT NULL,
+ bl_sitewide SMALLINT DEFAULT 1 NOT NULL
+);
+
+CREATE INDEX bl_timestamp ON /*_*/block (bl_timestamp);
+
+CREATE INDEX bl_target ON /*_*/block (bl_target);
+
+CREATE INDEX bl_expiry ON /*_*/block (bl_expiry);
+
+CREATE INDEX bl_parent_block_id ON /*_*/block (bl_parent_block_id);
+
+
+CREATE TABLE /*_*/block_target (
+ bt_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ bt_address BLOB DEFAULT NULL, bt_user INTEGER UNSIGNED DEFAULT NULL,
+ bt_user_text BLOB DEFAULT NULL, bt_auto SMALLINT DEFAULT 0 NOT NULL,
+ bt_range_start BLOB DEFAULT NULL,
+ bt_range_end BLOB DEFAULT NULL, bt_ip_hex BLOB DEFAULT NULL,
+ bt_count INTEGER DEFAULT 0 NOT NULL
+);
+
+CREATE INDEX bt_address ON /*_*/block_target (bt_address);
+
+CREATE INDEX bt_ip_user_text ON /*_*/block_target (bt_ip_hex, bt_user_text);
+
+CREATE INDEX bt_range ON /*_*/block_target (bt_range_start, bt_range_end);
+
+CREATE INDEX bt_user ON /*_*/block_target (bt_user);
diff --git a/sql/sqlite/patch-category-cat_title-varbinary.sql b/sql/sqlite/patch-category-cat_title-varbinary.sql
new file mode 100644
index 000000000000..2fb03a58d230
--- /dev/null
+++ b/sql/sqlite/patch-category-cat_title-varbinary.sql
@@ -0,0 +1,15 @@
+CREATE TABLE /*_*/category_tmp (
+ cat_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ cat_title BLOB NOT NULL,
+ cat_pages INTEGER DEFAULT 0 NOT NULL,
+ cat_subcats INTEGER DEFAULT 0 NOT NULL,
+ cat_files INTEGER DEFAULT 0 NOT NULL
+);
+INSERT INTO /*_*/category_tmp
+ SELECT cat_id, cat_title, cat_pages, cat_subcats, cat_files
+ FROM /*_*/category;
+DROP TABLE /*_*/category;
+ALTER TABLE /*_*/category_tmp RENAME TO /*_*/category;
+
+CREATE UNIQUE INDEX cat_title ON /*_*/category (cat_title);
+CREATE INDEX cat_pages ON /*_*/category (cat_pages);
diff --git a/sql/sqlite/patch-categorylinks-cl_to-varbinary.sql b/sql/sqlite/patch-categorylinks-cl_to-varbinary.sql
new file mode 100644
index 000000000000..fe0b44c7857c
--- /dev/null
+++ b/sql/sqlite/patch-categorylinks-cl_to-varbinary.sql
@@ -0,0 +1,28 @@
+CREATE TABLE /*_*/categorylinks_tmp (
+ cl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ cl_to BLOB DEFAULT '' NOT NULL,
+ cl_sortkey BLOB DEFAULT '' NOT NULL,
+ cl_sortkey_prefix BLOB DEFAULT '' NOT NULL,
+ cl_timestamp DATETIME NOT NULL,
+ cl_collation BLOB DEFAULT '' NOT NULL,
+ cl_type TEXT DEFAULT 'page' NOT NULL,
+ PRIMARY KEY(cl_from, cl_to)
+);
+
+
+INSERT INTO /*_*/categorylinks_tmp (cl_from, cl_to, cl_sortkey, cl_sortkey_prefix, cl_timestamp, cl_collation, cl_type)
+ SELECT cl_from, cl_to, cl_sortkey, cl_sortkey_prefix, cl_timestamp, cl_collation, cl_type
+ FROM /*_*/categorylinks;
+DROP TABLE /*_*/categorylinks;
+ALTER TABLE /*_*/categorylinks_tmp RENAME TO /*_*/categorylinks;
+
+
+CREATE INDEX cl_sortkey ON /*_*/categorylinks (
+ cl_to, cl_type, cl_sortkey, cl_from
+);
+
+CREATE INDEX cl_timestamp ON /*_*/categorylinks (cl_to, cl_timestamp);
+
+CREATE INDEX cl_collation_ext ON /*_*/categorylinks (
+ cl_collation, cl_to, cl_type, cl_from
+);
diff --git a/sql/sqlite/patch-change_tag-ct_rc_id.sql b/sql/sqlite/patch-change_tag-ct_rc_id.sql
new file mode 100644
index 000000000000..331d47d2b87e
--- /dev/null
+++ b/sql/sqlite/patch-change_tag-ct_rc_id.sql
@@ -0,0 +1,17 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-change_tag-ct_rc_id.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TEMPORARY TABLE /*_*/__temp__change_tag AS
+SELECT ct_id, ct_rc_id, ct_log_id, ct_rev_id, ct_params, ct_tag_id
+FROM /*_*/change_tag;
+DROP TABLE /*_*/change_tag;
+CREATE TABLE /*_*/change_tag ( ct_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ct_rc_id BIGINT UNSIGNED DEFAULT NULL, ct_log_id INTEGER UNSIGNED DEFAULT NULL, ct_rev_id INTEGER UNSIGNED DEFAULT NULL, ct_params BLOB DEFAULT NULL, ct_tag_id INTEGER UNSIGNED NOT NULL );
+INSERT INTO /*_*/change_tag ( ct_id, ct_rc_id, ct_log_id, ct_rev_id, ct_params, ct_tag_id )
+SELECT ct_id, ct_rc_id, ct_log_id, ct_rev_id, ct_params, ct_tag_id
+FROM /*_*/__temp__change_tag;
+DROP TABLE /*_*/__temp__change_tag;
+CREATE UNIQUE INDEX ct_rc_tag_id ON /*_*/change_tag (ct_rc_id, ct_tag_id);
+CREATE UNIQUE INDEX ct_log_tag_id ON /*_*/change_tag (ct_log_id, ct_tag_id);
+CREATE UNIQUE INDEX ct_rev_tag_id ON /*_*/change_tag (ct_rev_id, ct_tag_id);
+CREATE INDEX ct_tag_id_id ON /*_*/change_tag ( ct_tag_id, ct_rc_id, ct_rev_id, ct_log_id ); \ No newline at end of file
diff --git a/sql/sqlite/patch-change_tag-rename-indexes.sql b/sql/sqlite/patch-change_tag-rename-indexes.sql
new file mode 100644
index 000000000000..4da9f70cb499
--- /dev/null
+++ b/sql/sqlite/patch-change_tag-rename-indexes.sql
@@ -0,0 +1,21 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-change_tag-rename-indexes.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX change_tag_rc_tag_id;
+DROP INDEX change_tag_log_tag_id;
+DROP INDEX change_tag_rev_tag_id;
+DROP INDEX change_tag_tag_id_id;
+CREATE TEMPORARY TABLE /*_*/__temp__change_tag AS
+SELECT ct_id, ct_rc_id, ct_log_id, ct_rev_id, ct_params, ct_tag_id
+FROM /*_*/change_tag;
+DROP TABLE /*_*/change_tag;
+CREATE TABLE /*_*/change_tag ( ct_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ct_rc_id INTEGER UNSIGNED DEFAULT NULL, ct_log_id INTEGER UNSIGNED DEFAULT NULL, ct_rev_id INTEGER UNSIGNED DEFAULT NULL, ct_params BLOB DEFAULT NULL, ct_tag_id INTEGER UNSIGNED NOT NULL );
+INSERT INTO /*_*/change_tag ( ct_id, ct_rc_id, ct_log_id, ct_rev_id, ct_params, ct_tag_id )
+SELECT ct_id, ct_rc_id, ct_log_id, ct_rev_id, ct_params, ct_tag_id
+FROM /*_*/__temp__change_tag;
+DROP TABLE /*_*/__temp__change_tag;
+CREATE UNIQUE INDEX ct_rc_tag_id ON /*_*/change_tag (ct_rc_id, ct_tag_id);
+CREATE UNIQUE INDEX ct_log_tag_id ON /*_*/change_tag (ct_log_id, ct_tag_id);
+CREATE UNIQUE INDEX ct_rev_tag_id ON /*_*/change_tag (ct_rev_id, ct_tag_id);
+CREATE INDEX ct_tag_id_id ON /*_*/change_tag ( ct_tag_id, ct_rc_id, ct_rev_id, ct_log_id ); \ No newline at end of file
diff --git a/sql/sqlite/patch-content-content_id-fix_not_null.sql b/sql/sqlite/patch-content-content_id-fix_not_null.sql
new file mode 100644
index 000000000000..393c01d31345
--- /dev/null
+++ b/sql/sqlite/patch-content-content_id-fix_not_null.sql
@@ -0,0 +1,13 @@
+CREATE TABLE /*_*/content_tmp (
+ content_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ content_size INTEGER UNSIGNED NOT NULL,
+ content_sha1 BLOB NOT NULL,
+ content_model SMALLINT UNSIGNED NOT NULL,
+ content_address BLOB NOT NULL
+);
+
+INSERT INTO /*_*/content_tmp
+ SELECT content_id, content_size, content_sha1, content_model, content_address
+ FROM /*_*/content;
+DROP TABLE /*_*/content;
+ALTER TABLE /*_*/content_tmp RENAME TO /*_*/content;
diff --git a/sql/sqlite/patch-content_models-model_id-fix_not_null.sql b/sql/sqlite/patch-content_models-model_id-fix_not_null.sql
new file mode 100644
index 000000000000..60edb90e2ee8
--- /dev/null
+++ b/sql/sqlite/patch-content_models-model_id-fix_not_null.sql
@@ -0,0 +1,11 @@
+CREATE TABLE /*_*/content_models_tmp (
+ model_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ model_name BLOB NOT NULL
+);
+
+INSERT INTO /*_*/content_models_tmp
+ SELECT model_id, model_name
+ FROM /*_*/content_models;
+DROP TABLE /*_*/content_models;
+ALTER TABLE /*_*/content_models_tmp RENAME TO /*_*/content_models;
+CREATE UNIQUE INDEX model_name ON /*_*/content_models (model_name);
diff --git a/sql/sqlite/patch-drop-cl_collation_ext.sql b/sql/sqlite/patch-drop-cl_collation_ext.sql
new file mode 100644
index 000000000000..2a8561080c7d
--- /dev/null
+++ b/sql/sqlite/patch-drop-cl_collation_ext.sql
@@ -0,0 +1,48 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-drop-cl_collation_ext.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TEMPORARY TABLE /*_*/__temp__categorylinks AS
+SELECT
+ cl_from,
+ cl_to,
+ cl_sortkey,
+ cl_sortkey_prefix,
+ cl_timestamp,
+ cl_collation,
+ cl_type
+FROM /*_*/categorylinks;
+DROP TABLE /*_*/categorylinks;
+
+
+CREATE TABLE /*_*/categorylinks (
+ cl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ cl_to BLOB DEFAULT '' NOT NULL,
+ cl_sortkey BLOB DEFAULT '' NOT NULL,
+ cl_sortkey_prefix BLOB DEFAULT '' NOT NULL,
+ cl_timestamp DATETIME NOT NULL,
+ cl_collation BLOB DEFAULT '' NOT NULL,
+ cl_type TEXT DEFAULT 'page' NOT NULL,
+ PRIMARY KEY(cl_from, cl_to)
+ );
+INSERT INTO /*_*/categorylinks (
+ cl_from, cl_to, cl_sortkey, cl_sortkey_prefix,
+ cl_timestamp, cl_collation, cl_type
+ )
+SELECT
+ cl_from,
+ cl_to,
+ cl_sortkey,
+ cl_sortkey_prefix,
+ cl_timestamp,
+ cl_collation,
+ cl_type
+FROM
+ /*_*/__temp__categorylinks;
+DROP TABLE /*_*/__temp__categorylinks;
+
+CREATE INDEX cl_sortkey ON /*_*/categorylinks (
+ cl_to, cl_type, cl_sortkey, cl_from
+ );
+
+CREATE INDEX cl_timestamp ON /*_*/categorylinks (cl_to, cl_timestamp);
diff --git a/sql/sqlite/patch-drop-page_restrictions-pr_user.sql b/sql/sqlite/patch-drop-page_restrictions-pr_user.sql
new file mode 100644
index 000000000000..f0880ae6797b
--- /dev/null
+++ b/sql/sqlite/patch-drop-page_restrictions-pr_user.sql
@@ -0,0 +1,21 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-drop-page_restrictions-pr_user.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX pr_pagetype;
+DROP INDEX pr_typelevel;
+DROP INDEX pr_level;
+DROP INDEX pr_cascade;
+CREATE TEMPORARY TABLE /*_*/__temp__page_restrictions AS
+SELECT pr_id, pr_page, pr_type, pr_level, pr_cascade, pr_expiry
+FROM /*_*/page_restrictions;
+DROP TABLE /*_*/page_restrictions;
+CREATE TABLE /*_*/page_restrictions ( pr_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, pr_page INTEGER NOT NULL, pr_type BLOB NOT NULL, pr_level BLOB NOT NULL, pr_cascade SMALLINT NOT NULL, pr_expiry BLOB DEFAULT NULL );
+INSERT INTO /*_*/page_restrictions ( pr_id, pr_page, pr_type, pr_level, pr_cascade, pr_expiry )
+SELECT pr_id, pr_page, pr_type, pr_level, pr_cascade, pr_expiry
+FROM /*_*/__temp__page_restrictions;
+DROP TABLE /*_*/__temp__page_restrictions;
+CREATE UNIQUE INDEX pr_pagetype ON /*_*/page_restrictions (pr_page, pr_type);
+CREATE INDEX pr_typelevel ON /*_*/page_restrictions (pr_type, pr_level);
+CREATE INDEX pr_level ON /*_*/page_restrictions (pr_level);
+CREATE INDEX pr_cascade ON /*_*/page_restrictions (pr_cascade);
diff --git a/sql/sqlite/patch-drop-rev_page_id.sql b/sql/sqlite/patch-drop-rev_page_id.sql
new file mode 100644
index 000000000000..37683a787461
--- /dev/null
+++ b/sql/sqlite/patch-drop-rev_page_id.sql
@@ -0,0 +1,22 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-drop-rev_page_id.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX rev_page_id;
+DROP INDEX rev_timestamp;
+DROP INDEX rev_page_timestamp;
+DROP INDEX rev_actor_timestamp;
+DROP INDEX rev_page_actor_timestamp;
+CREATE TEMPORARY TABLE /*_*/__temp__revision AS
+SELECT rev_id, rev_page, rev_comment_id, rev_actor, rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id, rev_sha1
+FROM /*_*/revision;
+DROP TABLE /*_*/revision;
+CREATE TABLE /*_*/revision ( rev_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, rev_page INTEGER UNSIGNED NOT NULL, rev_comment_id BIGINT UNSIGNED DEFAULT 0 NOT NULL, rev_actor BIGINT UNSIGNED DEFAULT 0 NOT NULL, rev_timestamp BLOB NOT NULL, rev_minor_edit SMALLINT UNSIGNED DEFAULT 0 NOT NULL, rev_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL, rev_len INTEGER UNSIGNED DEFAULT NULL, rev_parent_id INTEGER UNSIGNED DEFAULT NULL, rev_sha1 BLOB DEFAULT '' NOT NULL );
+INSERT INTO /*_*/revision ( rev_id, rev_page, rev_comment_id, rev_actor, rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id, rev_sha1 )
+SELECT rev_id, rev_page, rev_comment_id, rev_actor, rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id, rev_sha1
+FROM /*_*/__temp__revision;
+DROP TABLE /*_*/__temp__revision;
+CREATE INDEX rev_timestamp ON /*_*/revision (rev_timestamp);
+CREATE INDEX rev_page_timestamp ON /*_*/revision (rev_page, rev_timestamp);
+CREATE INDEX rev_actor_timestamp ON /*_*/revision (rev_actor, rev_timestamp, rev_id);
+CREATE INDEX rev_page_actor_timestamp ON /*_*/revision ( rev_page, rev_actor, rev_timestamp ); \ No newline at end of file
diff --git a/sql/sqlite/patch-externallinks-drop-el_to.sql b/sql/sqlite/patch-externallinks-drop-el_to.sql
new file mode 100644
index 000000000000..d8041c8c03fd
--- /dev/null
+++ b/sql/sqlite/patch-externallinks-drop-el_to.sql
@@ -0,0 +1,15 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-externallinks-drop-el_to.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TEMPORARY TABLE /*_*/__temp__externallinks AS
+SELECT el_id, el_from, el_to_domain_index, el_to_path
+FROM /*_*/externallinks;
+DROP TABLE /*_*/externallinks;
+CREATE TABLE /*_*/externallinks ( el_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, el_from INTEGER UNSIGNED DEFAULT 0 NOT NULL, el_to_domain_index BLOB DEFAULT '' NOT NULL, el_to_path BLOB DEFAULT NULL );
+INSERT INTO /*_*/externallinks ( el_id, el_from, el_to_domain_index, el_to_path )
+SELECT el_id, el_from, el_to_domain_index, el_to_path
+FROM /*_*/__temp__externallinks;
+DROP TABLE /*_*/__temp__externallinks;
+CREATE INDEX el_from ON /*_*/externallinks (el_from);
+CREATE INDEX el_to_domain_index_to_path ON /*_*/externallinks (el_to_domain_index, el_to_path); \ No newline at end of file
diff --git a/sql/sqlite/patch-externallinks-el_to_default.sql b/sql/sqlite/patch-externallinks-el_to_default.sql
new file mode 100644
index 000000000000..eb00d698701f
--- /dev/null
+++ b/sql/sqlite/patch-externallinks-el_to_default.sql
@@ -0,0 +1,19 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-externallinks-el_to_default.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TEMPORARY TABLE /*_*/__temp__externallinks AS
+SELECT el_id, el_from, el_to, el_index, el_index_60, el_to_domain_index, el_to_path
+FROM /*_*/externallinks;
+DROP TABLE /*_*/externallinks;
+CREATE TABLE /*_*/externallinks ( el_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, el_from INTEGER UNSIGNED DEFAULT 0 NOT NULL, el_to BLOB DEFAULT '', el_index BLOB DEFAULT '', el_index_60 BLOB DEFAULT '' NOT NULL, el_to_domain_index BLOB DEFAULT '' NOT NULL, el_to_path BLOB DEFAULT NULL );
+INSERT INTO /*_*/externallinks ( el_id, el_from, el_to, el_index, el_index_60, el_to_domain_index, el_to_path )
+SELECT el_id, el_from, el_to, el_index, el_index_60, el_to_domain_index, el_to_path
+FROM /*_*/__temp__externallinks;
+DROP TABLE /*_*/__temp__externallinks;
+CREATE INDEX el_from ON /*_*/externallinks (el_from);
+CREATE INDEX el_to ON /*_*/externallinks (el_to, el_from);
+CREATE INDEX el_index ON /*_*/externallinks (el_index);
+CREATE INDEX el_index_60 ON /*_*/externallinks (el_index_60, el_id);
+CREATE INDEX el_from_index_60 ON /*_*/externallinks (el_from, el_index_60, el_id);
+CREATE INDEX el_to_domain_index_to_path ON /*_*/externallinks (el_to_domain_index, el_to_path); \ No newline at end of file
diff --git a/sql/sqlite/patch-externallinks-el_to_path.sql b/sql/sqlite/patch-externallinks-el_to_path.sql
new file mode 100644
index 000000000000..6ab5b1257ca8
--- /dev/null
+++ b/sql/sqlite/patch-externallinks-el_to_path.sql
@@ -0,0 +1,24 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-externallinks-el_to_path.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX el_from;
+DROP INDEX el_to;
+DROP INDEX el_index;
+DROP INDEX el_index_60;
+DROP INDEX el_from_index_60;
+CREATE TEMPORARY TABLE /*_*/__temp__externallinks AS
+SELECT el_id, el_from, el_to, el_index, el_index_60
+FROM /*_*/externallinks;
+DROP TABLE /*_*/externallinks;
+CREATE TABLE /*_*/externallinks ( el_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, el_from INTEGER UNSIGNED DEFAULT 0 NOT NULL, el_to BLOB NOT NULL, el_index BLOB NOT NULL, el_index_60 BLOB NOT NULL, el_to_domain_index BLOB DEFAULT '' NOT NULL, el_to_path BLOB DEFAULT NULL );
+INSERT INTO /*_*/externallinks ( el_id, el_from, el_to, el_index, el_index_60 )
+SELECT el_id, el_from, el_to, el_index, el_index_60
+FROM /*_*/__temp__externallinks;
+DROP TABLE /*_*/__temp__externallinks;
+CREATE INDEX el_from ON /*_*/externallinks (el_from);
+CREATE INDEX el_to ON /*_*/externallinks (el_to, el_from);
+CREATE INDEX el_index ON /*_*/externallinks (el_index);
+CREATE INDEX el_index_60 ON /*_*/externallinks (el_index_60, el_id);
+CREATE INDEX el_from_index_60 ON /*_*/externallinks (el_from, el_index_60, el_id);
+CREATE INDEX el_to_domain_index_to_path ON /*_*/externallinks (el_to_domain_index, el_to_path); \ No newline at end of file
diff --git a/sql/sqlite/patch-filearchive-fa_name.sql b/sql/sqlite/patch-filearchive-fa_name.sql
new file mode 100644
index 000000000000..7beb0c0f43df
--- /dev/null
+++ b/sql/sqlite/patch-filearchive-fa_name.sql
@@ -0,0 +1,41 @@
+-- Modify fa_name and fa_storage_group to be BLOB and drop default from fa_deleted_timestamp and fa_timestamp
+CREATE TABLE /*_*/filearchive_tmp (
+ fa_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ fa_name BLOB DEFAULT '' NOT NULL, fa_archive_name BLOB DEFAULT '',
+ fa_storage_group BLOB DEFAULT NULL,
+ fa_storage_key BLOB DEFAULT '', fa_deleted_user INTEGER DEFAULT NULL,
+ fa_deleted_timestamp BLOB DEFAULT NULL,
+ fa_deleted_reason_id BIGINT UNSIGNED NOT NULL,
+ fa_size INTEGER UNSIGNED DEFAULT 0,
+ fa_width INTEGER DEFAULT 0, fa_height INTEGER DEFAULT 0,
+ fa_metadata BLOB DEFAULT NULL, fa_bits INTEGER DEFAULT 0,
+ fa_media_type TEXT DEFAULT NULL, fa_major_mime TEXT DEFAULT 'unknown',
+ fa_minor_mime BLOB DEFAULT 'unknown',
+ fa_description_id BIGINT UNSIGNED NOT NULL,
+ fa_actor BIGINT UNSIGNED NOT NULL,
+ fa_timestamp BLOB DEFAULT NULL, fa_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ fa_sha1 BLOB DEFAULT '' NOT NULL
+);
+INSERT INTO /*_*/filearchive_tmp (
+ fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, fa_deleted_user, fa_deleted_timestamp,
+ fa_deleted_reason_id, fa_size, fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime,
+ fa_minor_mime, fa_description_id, fa_actor, fa_timestamp, fa_deleted, fa_sha1
+)
+SELECT fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, fa_deleted_user, fa_deleted_timestamp,
+ fa_deleted_reason_id, fa_size, fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime,
+ fa_minor_mime, fa_description_id, fa_actor, fa_timestamp, fa_deleted, fa_sha1
+FROM /*_*/filearchive;
+DROP TABLE /*_*/filearchive;
+ALTER TABLE /*_*/filearchive_tmp RENAME TO /*_*/filearchive;
+
+CREATE INDEX fa_name ON /*_*/filearchive (fa_name, fa_timestamp);
+
+CREATE INDEX fa_storage_group ON /*_*/filearchive (
+ fa_storage_group, fa_storage_key
+);
+
+CREATE INDEX fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp);
+
+CREATE INDEX fa_actor_timestamp ON /*_*/filearchive (fa_actor, fa_timestamp);
+
+CREATE INDEX fa_sha1 ON /*_*/filearchive (fa_sha1);
diff --git a/sql/sqlite/patch-filearchive-fa_size_to_bigint.sql b/sql/sqlite/patch-filearchive-fa_size_to_bigint.sql
new file mode 100644
index 000000000000..c350c1da210f
--- /dev/null
+++ b/sql/sqlite/patch-filearchive-fa_size_to_bigint.sql
@@ -0,0 +1,18 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: abstractSchemaChanges/patch-filearchive-fa_size_to_bigint.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TEMPORARY TABLE /*_*/__temp__filearchive AS
+SELECT fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, fa_deleted_user, fa_deleted_timestamp, fa_deleted_reason_id, fa_size, fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime, fa_minor_mime, fa_description_id, fa_actor, fa_timestamp, fa_deleted, fa_sha1
+FROM /*_*/filearchive;
+DROP TABLE /*_*/filearchive;
+CREATE TABLE /*_*/filearchive ( fa_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, fa_name BLOB DEFAULT '' NOT NULL, fa_archive_name BLOB DEFAULT '', fa_storage_group BLOB DEFAULT NULL, fa_storage_key BLOB DEFAULT '', fa_deleted_user INTEGER DEFAULT NULL, fa_deleted_timestamp BLOB DEFAULT NULL, fa_deleted_reason_id BIGINT UNSIGNED NOT NULL, fa_size BIGINT UNSIGNED DEFAULT 0, fa_width INTEGER DEFAULT 0, fa_height INTEGER DEFAULT 0, fa_metadata BLOB DEFAULT NULL, fa_bits INTEGER DEFAULT 0, fa_media_type TEXT DEFAULT NULL, fa_major_mime TEXT DEFAULT 'unknown', fa_minor_mime BLOB DEFAULT 'unknown', fa_description_id BIGINT UNSIGNED NOT NULL, fa_actor BIGINT UNSIGNED NOT NULL, fa_timestamp BLOB DEFAULT NULL, fa_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL, fa_sha1 BLOB DEFAULT '' NOT NULL );
+INSERT INTO /*_*/filearchive ( fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, fa_deleted_user, fa_deleted_timestamp, fa_deleted_reason_id, fa_size, fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime, fa_minor_mime, fa_description_id, fa_actor, fa_timestamp, fa_deleted, fa_sha1 )
+SELECT fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, fa_deleted_user, fa_deleted_timestamp, fa_deleted_reason_id, fa_size, fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime, fa_minor_mime, fa_description_id, fa_actor, fa_timestamp, fa_deleted, fa_sha1
+FROM /*_*/__temp__filearchive;
+DROP TABLE /*_*/__temp__filearchive;
+CREATE INDEX fa_name ON /*_*/filearchive (fa_name, fa_timestamp);
+CREATE INDEX fa_storage_group ON /*_*/filearchive ( fa_storage_group, fa_storage_key );
+CREATE INDEX fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp);
+CREATE INDEX fa_actor_timestamp ON /*_*/filearchive (fa_actor, fa_timestamp);
+CREATE INDEX fa_sha1 ON /*_*/filearchive (fa_sha1); \ No newline at end of file
diff --git a/sql/sqlite/patch-image-img_name-varbinary.sql b/sql/sqlite/patch-image-img_name-varbinary.sql
new file mode 100644
index 000000000000..51fb20ca8a8e
--- /dev/null
+++ b/sql/sqlite/patch-image-img_name-varbinary.sql
@@ -0,0 +1,35 @@
+CREATE TABLE image_tmp (
+ img_name BLOB DEFAULT '' NOT NULL,
+ img_size INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ img_width INTEGER DEFAULT 0 NOT NULL,
+ img_height INTEGER DEFAULT 0 NOT NULL,
+ img_metadata BLOB NOT NULL,
+ img_bits INTEGER DEFAULT 0 NOT NULL,
+ img_media_type TEXT DEFAULT NULL,
+ img_major_mime TEXT DEFAULT 'unknown' NOT NULL,
+ img_minor_mime BLOB DEFAULT 'unknown' NOT NULL,
+ img_description_id BIGINT UNSIGNED NOT NULL,
+ img_actor BIGINT UNSIGNED NOT NULL,
+ img_timestamp BLOB NOT NULL,
+ img_sha1 BLOB DEFAULT '' NOT NULL,
+ PRIMARY KEY(img_name)
+);
+INSERT 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_id, img_actor, 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_id, img_actor, img_timestamp, img_sha1
+FROM /*_*/image;
+DROP TABLE /*_*/image;
+ALTER TABLE /*_*/image_tmp RENAME TO /*_*/image;
+CREATE INDEX img_actor_timestamp ON /*_*/image (img_actor, img_timestamp);
+
+CREATE INDEX img_size ON /*_*/image (img_size);
+
+CREATE INDEX img_timestamp ON /*_*/image (img_timestamp);
+
+CREATE INDEX img_sha1 ON /*_*/image (img_sha1);
+
+CREATE INDEX img_media_mime ON /*_*/image (
+ img_media_type, img_major_mime, img_minor_mime
+);
diff --git a/sql/sqlite/patch-image-img_size_to_bigint.sql b/sql/sqlite/patch-image-img_size_to_bigint.sql
new file mode 100644
index 000000000000..05fa7871d3c2
--- /dev/null
+++ b/sql/sqlite/patch-image-img_size_to_bigint.sql
@@ -0,0 +1,18 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: abstractSchemaChanges/patch-image-img_size_to_bigint.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TEMPORARY TABLE /*_*/__temp__image AS
+SELECT img_name, img_size, img_width, img_height, img_metadata, img_bits, img_media_type, img_major_mime, img_minor_mime, img_description_id, img_actor, img_timestamp, img_sha1
+FROM /*_*/image;
+DROP TABLE /*_*/image;
+CREATE TABLE /*_*/image ( img_name BLOB DEFAULT '' NOT NULL, img_size BIGINT UNSIGNED DEFAULT 0 NOT NULL, img_width INTEGER DEFAULT 0 NOT NULL, img_height INTEGER DEFAULT 0 NOT NULL, img_metadata BLOB NOT NULL, img_bits INTEGER DEFAULT 0 NOT NULL, img_media_type TEXT DEFAULT NULL, img_major_mime TEXT DEFAULT 'unknown' NOT NULL, img_minor_mime BLOB DEFAULT 'unknown' NOT NULL, img_description_id BIGINT UNSIGNED NOT NULL, img_actor BIGINT UNSIGNED NOT NULL, img_timestamp BLOB NOT NULL, img_sha1 BLOB DEFAULT '' NOT NULL, PRIMARY KEY(img_name) );
+INSERT INTO /*_*/image ( img_name, img_size, img_width, img_height, img_metadata, img_bits, img_media_type, img_major_mime, img_minor_mime, img_description_id, img_actor, 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_id, img_actor, img_timestamp, img_sha1
+FROM /*_*/__temp__image;
+DROP TABLE /*_*/__temp__image;
+CREATE INDEX img_actor_timestamp ON /*_*/image (img_actor, img_timestamp);
+CREATE INDEX img_size ON /*_*/image (img_size);
+CREATE INDEX img_timestamp ON /*_*/image (img_timestamp);
+CREATE INDEX img_sha1 ON /*_*/image (img_sha1);
+CREATE INDEX img_media_mime ON /*_*/image ( img_media_type, img_major_mime, img_minor_mime ); \ No newline at end of file
diff --git a/sql/sqlite/patch-imagelinks-il_to-varbinary.sql b/sql/sqlite/patch-imagelinks-il_to-varbinary.sql
new file mode 100644
index 000000000000..5eeaeca6b01b
--- /dev/null
+++ b/sql/sqlite/patch-imagelinks-il_to-varbinary.sql
@@ -0,0 +1,18 @@
+CREATE TABLE /*_*/imagelinks_tmp (
+ il_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ il_to BLOB DEFAULT '' NOT NULL,
+ il_from_namespace INTEGER DEFAULT 0 NOT NULL,
+ PRIMARY KEY(il_from, il_to)
+);
+
+INSERT INTO /*_*/imagelinks_tmp
+ SELECT il_from, il_to, il_from_namespace
+ FROM /*_*/imagelinks;
+DROP TABLE /*_*/imagelinks;
+ALTER TABLE /*_*/imagelinks_tmp RENAME TO /*_*/imagelinks;
+
+CREATE INDEX il_to ON /*_*/imagelinks (il_to, il_from);
+
+CREATE INDEX il_backlinks_namespace ON /*_*/imagelinks (
+ il_from_namespace, il_to, il_from
+);
diff --git a/sql/sqlite/patch-ip_changes-pc_rev_timestamp-drop-default.sql b/sql/sqlite/patch-ip_changes-pc_rev_timestamp-drop-default.sql
new file mode 100644
index 000000000000..1928ae3d3d6b
--- /dev/null
+++ b/sql/sqlite/patch-ip_changes-pc_rev_timestamp-drop-default.sql
@@ -0,0 +1,17 @@
+CREATE TABLE /*_*/ip_changes_tmp (
+ ipc_rev_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ ipc_rev_timestamp BLOB NOT NULL,
+ ipc_hex BLOB DEFAULT '' NOT NULL,
+ PRIMARY KEY(ipc_rev_id)
+);
+
+INSERT INTO /*_*/ip_changes_tmp
+ SELECT ipc_rev_id, ipc_rev_timestamp, ipc_hex
+ FROM /*_*/ip_changes;
+DROP TABLE /*_*/ip_changes;
+ALTER TABLE /*_*/ip_changes_tmp RENAME TO /*_*/ip_changes;
+
+
+CREATE INDEX ipc_rev_timestamp ON /*_*/ip_changes (ipc_rev_timestamp);
+
+CREATE INDEX ipc_hex_time ON /*_*/ip_changes (ipc_hex, ipc_rev_timestamp);
diff --git a/sql/sqlite/patch-ipblocks-ipb_id.sql b/sql/sqlite/patch-ipblocks-ipb_id.sql
new file mode 100644
index 000000000000..832214f735d9
--- /dev/null
+++ b/sql/sqlite/patch-ipblocks-ipb_id.sql
@@ -0,0 +1,25 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-ipblocks-ipb_id.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX ipb_address_unique;
+DROP INDEX ipb_user;
+DROP INDEX ipb_range;
+DROP INDEX ipb_timestamp;
+DROP INDEX ipb_expiry;
+DROP INDEX ipb_parent_block_id;
+CREATE TEMPORARY TABLE /*_*/__temp__ipblocks AS
+SELECT ipb_id, ipb_address, ipb_user, ipb_by_actor, ipb_reason_id, 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, ipb_sitewide
+FROM /*_*/ipblocks;
+DROP TABLE /*_*/ipblocks;
+CREATE TABLE /*_*/ipblocks ( ipb_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ipb_address BLOB NOT NULL, ipb_user INTEGER UNSIGNED DEFAULT 0 NOT NULL, ipb_by_actor BIGINT UNSIGNED NOT NULL, ipb_reason_id BIGINT UNSIGNED NOT NULL, ipb_timestamp BLOB NOT NULL, ipb_auto SMALLINT DEFAULT 0 NOT NULL, ipb_anon_only SMALLINT DEFAULT 0 NOT NULL, ipb_create_account SMALLINT DEFAULT 1 NOT NULL, ipb_enable_autoblock SMALLINT DEFAULT 1 NOT NULL, ipb_expiry BLOB NOT NULL, ipb_range_start BLOB NOT NULL, ipb_range_end BLOB NOT NULL, ipb_deleted SMALLINT DEFAULT 0 NOT NULL, ipb_block_email SMALLINT DEFAULT 0 NOT NULL, ipb_allow_usertalk SMALLINT DEFAULT 0 NOT NULL, ipb_parent_block_id INTEGER UNSIGNED DEFAULT NULL, ipb_sitewide SMALLINT DEFAULT 1 NOT NULL );
+INSERT INTO /*_*/ipblocks ( ipb_id, ipb_address, ipb_user, ipb_by_actor, ipb_reason_id, 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, ipb_sitewide )
+SELECT ipb_id, ipb_address, ipb_user, ipb_by_actor, ipb_reason_id, 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, ipb_sitewide
+FROM /*_*/__temp__ipblocks;
+DROP TABLE /*_*/__temp__ipblocks;
+CREATE UNIQUE INDEX ipb_address_unique ON /*_*/ipblocks (ipb_address, ipb_user, ipb_auto);
+CREATE INDEX ipb_user ON /*_*/ipblocks (ipb_user);
+CREATE INDEX ipb_range ON /*_*/ipblocks (ipb_range_start, ipb_range_end);
+CREATE INDEX ipb_timestamp ON /*_*/ipblocks (ipb_timestamp);
+CREATE INDEX ipb_expiry ON /*_*/ipblocks (ipb_expiry);
+CREATE INDEX ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id); \ No newline at end of file
diff --git a/sql/sqlite/patch-ipblocks-ipb_timestamp-drop-default.sql b/sql/sqlite/patch-ipblocks-ipb_timestamp-drop-default.sql
new file mode 100644
index 000000000000..71441fc2e5d7
--- /dev/null
+++ b/sql/sqlite/patch-ipblocks-ipb_timestamp-drop-default.sql
@@ -0,0 +1,45 @@
+CREATE TABLE /*_*/ipblocks_tmp (
+ ipb_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ ipb_address BLOB NOT NULL, ipb_user INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ ipb_by_actor BIGINT UNSIGNED NOT NULL,
+ ipb_reason_id BIGINT UNSIGNED NOT NULL,
+ ipb_timestamp BLOB NOT NULL, ipb_auto SMALLINT DEFAULT 0 NOT NULL,
+ ipb_anon_only SMALLINT DEFAULT 0 NOT NULL,
+ ipb_create_account SMALLINT DEFAULT 1 NOT NULL,
+ ipb_enable_autoblock SMALLINT DEFAULT 1 NOT NULL,
+ ipb_expiry BLOB NOT NULL, ipb_range_start BLOB NOT NULL,
+ ipb_range_end BLOB NOT NULL, ipb_deleted SMALLINT DEFAULT 0 NOT NULL,
+ ipb_block_email SMALLINT DEFAULT 0 NOT NULL,
+ ipb_allow_usertalk SMALLINT DEFAULT 0 NOT NULL,
+ ipb_parent_block_id INTEGER DEFAULT NULL,
+ ipb_sitewide SMALLINT DEFAULT 1 NOT NULL
+);
+
+
+INSERT INTO /*_*/ipblocks_tmp (
+ ipb_id, ipb_address, ipb_user, ipb_by_actor, ipb_reason_id, 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, ipb_sitewide
+)
+SELECT
+ ipb_id, ipb_address, ipb_user, ipb_by_actor, ipb_reason_id, 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, ipb_sitewide
+FROM /*_*/ipblocks;
+DROP TABLE /*_*/ipblocks;
+ALTER TABLE /*_*/ipblocks_tmp RENAME TO /*_*/ipblocks;
+
+
+CREATE UNIQUE INDEX ipb_address_unique ON /*_*/ipblocks (ipb_address, ipb_user, ipb_auto);
+
+CREATE INDEX ipb_user ON /*_*/ipblocks (ipb_user);
+
+CREATE INDEX ipb_range ON /*_*/ipblocks (ipb_range_start, ipb_range_end);
+
+CREATE INDEX ipb_timestamp ON /*_*/ipblocks (ipb_timestamp);
+
+CREATE INDEX ipb_expiry ON /*_*/ipblocks (ipb_expiry);
+
+CREATE INDEX ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id);
diff --git a/sql/sqlite/patch-ipblocks_restrictions-ir_ipb_id.sql b/sql/sqlite/patch-ipblocks_restrictions-ir_ipb_id.sql
new file mode 100644
index 000000000000..49e6a7b05909
--- /dev/null
+++ b/sql/sqlite/patch-ipblocks_restrictions-ir_ipb_id.sql
@@ -0,0 +1,15 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-ipblocks_restrictions-ir_ipb_id.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX ir_type_value;
+CREATE TEMPORARY TABLE /*_*/__temp__ipblocks_restrictions AS
+SELECT ir_ipb_id, ir_type, ir_value
+FROM /*_*/ipblocks_restrictions;
+DROP TABLE /*_*/ipblocks_restrictions;
+CREATE TABLE /*_*/ipblocks_restrictions ( ir_ipb_id INTEGER UNSIGNED NOT NULL, ir_type SMALLINT NOT NULL, ir_value INTEGER UNSIGNED NOT NULL, PRIMARY KEY(ir_ipb_id, ir_type, ir_value) );
+INSERT INTO /*_*/ipblocks_restrictions (ir_ipb_id, ir_type, ir_value)
+SELECT ir_ipb_id, ir_type, ir_value
+FROM /*_*/__temp__ipblocks_restrictions;
+DROP TABLE /*_*/__temp__ipblocks_restrictions;
+CREATE INDEX ir_type_value ON /*_*/ipblocks_restrictions (ir_type, ir_value); \ No newline at end of file
diff --git a/sql/sqlite/patch-ipblocks_restrictions-ir_value.sql b/sql/sqlite/patch-ipblocks_restrictions-ir_value.sql
new file mode 100644
index 000000000000..4fdac77adf56
--- /dev/null
+++ b/sql/sqlite/patch-ipblocks_restrictions-ir_value.sql
@@ -0,0 +1,15 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-ipblocks_restrictions-ir_value.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX ir_type_value;
+CREATE TEMPORARY TABLE /*_*/__temp__ipblocks_restrictions AS
+SELECT ir_ipb_id, ir_type, ir_value
+FROM /*_*/ipblocks_restrictions;
+DROP TABLE /*_*/ipblocks_restrictions;
+CREATE TABLE /*_*/ipblocks_restrictions ( ir_ipb_id INTEGER NOT NULL, ir_type SMALLINT NOT NULL, ir_value INTEGER UNSIGNED NOT NULL, PRIMARY KEY(ir_ipb_id, ir_type, ir_value) );
+INSERT INTO /*_*/ipblocks_restrictions (ir_ipb_id, ir_type, ir_value)
+SELECT ir_ipb_id, ir_type, ir_value
+FROM /*_*/__temp__ipblocks_restrictions;
+DROP TABLE /*_*/__temp__ipblocks_restrictions;
+CREATE INDEX ir_type_value ON /*_*/ipblocks_restrictions (ir_type, ir_value); \ No newline at end of file
diff --git a/sql/sqlite/patch-iwlinks-drop-iwl_prefix_from_title.sql b/sql/sqlite/patch-iwlinks-drop-iwl_prefix_from_title.sql
new file mode 100644
index 000000000000..f37b4ab29f3e
--- /dev/null
+++ b/sql/sqlite/patch-iwlinks-drop-iwl_prefix_from_title.sql
@@ -0,0 +1,29 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-iwlinks-drop-iwl_prefix_from_title.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TEMPORARY TABLE /*_*/__temp__iwlinks AS
+SELECT
+ iwl_from,
+ iwl_prefix,
+ iwl_title
+FROM /*_*/iwlinks;
+DROP TABLE /*_*/iwlinks;
+
+
+CREATE TABLE /*_*/iwlinks (
+ iwl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ iwl_prefix BLOB DEFAULT '' NOT NULL,
+ iwl_title BLOB DEFAULT '' NOT NULL,
+ PRIMARY KEY(iwl_from, iwl_prefix, iwl_title)
+ );
+INSERT INTO /*_*/iwlinks (iwl_from, iwl_prefix, iwl_title)
+SELECT
+ iwl_from,
+ iwl_prefix,
+ iwl_title
+FROM
+ /*_*/__temp__iwlinks;
+DROP TABLE /*_*/__temp__iwlinks;
+
+CREATE INDEX iwl_prefix_title_from ON /*_*/iwlinks (iwl_prefix, iwl_title, iwl_from);
diff --git a/sql/sqlite/patch-iwlinks-iwl_title-varbinary.sql b/sql/sqlite/patch-iwlinks-iwl_title-varbinary.sql
new file mode 100644
index 000000000000..67acb930ecfd
--- /dev/null
+++ b/sql/sqlite/patch-iwlinks-iwl_title-varbinary.sql
@@ -0,0 +1,16 @@
+CREATE TABLE /*_*/iwlinks_tmp (
+ iwl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ iwl_prefix BLOB DEFAULT '' NOT NULL,
+ iwl_title BLOB DEFAULT '' NOT NULL,
+ PRIMARY KEY(iwl_from, iwl_prefix, iwl_title)
+);
+
+INSERT INTO /*_*/iwlinks_tmp
+ SELECT iwl_from, iwl_prefix, iwl_title
+ FROM /*_*/iwlinks;
+DROP TABLE /*_*/iwlinks;
+ALTER TABLE /*_*/iwlinks_tmp RENAME TO /*_*/iwlinks;
+
+CREATE INDEX iwl_prefix_title_from ON /*_*/iwlinks (iwl_prefix, iwl_title, iwl_from);
+
+CREATE INDEX iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title);
diff --git a/sql/sqlite/patch-job-job_title-varbinary.sql b/sql/sqlite/patch-job-job_title-varbinary.sql
new file mode 100644
index 000000000000..7f937500542a
--- /dev/null
+++ b/sql/sqlite/patch-job-job_title-varbinary.sql
@@ -0,0 +1,15 @@
+CREATE TABLE /*_*/redirect_tmp (
+ rd_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ rd_namespace INTEGER DEFAULT 0 NOT NULL,
+ rd_title BLOB DEFAULT '' NOT NULL,
+ rd_interwiki VARCHAR(32) DEFAULT NULL,
+ rd_fragment BLOB DEFAULT NULL,
+ PRIMARY KEY(rd_from)
+);
+INSERT INTO /*_*/redirect_tmp
+ SELECT rd_from, rd_namespace, rd_title, rd_interwiki, rd_fragment
+ FROM /*_*/redirect;
+DROP TABLE /*_*/redirect;
+ALTER TABLE /*_*/redirect_tmp RENAME TO /*_*/redirect;
+
+CREATE INDEX rd_ns_title ON /*_*/redirect (rd_namespace, rd_title, rd_from);
diff --git a/sql/sqlite/patch-langlinks-ll_title-varbinary.sql b/sql/sqlite/patch-langlinks-ll_title-varbinary.sql
new file mode 100644
index 000000000000..9fdec6cd507d
--- /dev/null
+++ b/sql/sqlite/patch-langlinks-ll_title-varbinary.sql
@@ -0,0 +1,14 @@
+CREATE TABLE /*_*/langlinks_tmp (
+ ll_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ ll_lang BLOB DEFAULT '' NOT NULL,
+ ll_title BLOB DEFAULT '' NOT NULL,
+ PRIMARY KEY(ll_from, ll_lang)
+);
+
+INSERT INTO /*_*/langlinks_tmp
+ SELECT ll_from, ll_lang, ll_title
+ FROM /*_*/langlinks;
+DROP TABLE /*_*/langlinks;
+ALTER TABLE /*_*/langlinks_tmp RENAME TO /*_*/langlinks;
+
+CREATE INDEX ll_lang ON /*_*/langlinks (ll_lang, ll_title);
diff --git a/sql/sqlite/patch-linktarget.sql b/sql/sqlite/patch-linktarget.sql
new file mode 100644
index 000000000000..e06a8822f74d
--- /dev/null
+++ b/sql/sqlite/patch-linktarget.sql
@@ -0,0 +1,6 @@
+CREATE TABLE /*_*/linktarget (
+ lt_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ lt_namespace INTEGER NOT NULL, lt_title BLOB NOT NULL
+);
+
+CREATE UNIQUE INDEX lt_namespace_title ON /*_*/linktarget (lt_namespace, lt_title);
diff --git a/sql/sqlite/patch-logging-log_title-varbinary.sql b/sql/sqlite/patch-logging-log_title-varbinary.sql
new file mode 100644
index 000000000000..5caeca41608d
--- /dev/null
+++ b/sql/sqlite/patch-logging-log_title-varbinary.sql
@@ -0,0 +1,42 @@
+CREATE TABLE /*_*/logging_temp (
+ log_id INTEGER NOT NULL,
+ log_type BLOB DEFAULT '' NOT NULL,
+ log_action BLOB DEFAULT '' NOT NULL,
+ log_timestamp BLOB DEFAULT '19700101000000' NOT NULL,
+ log_actor BIGINT UNSIGNED NOT NULL,
+ log_namespace INTEGER DEFAULT 0 NOT NULL,
+ log_title BLOB DEFAULT '' NOT NULL,
+ log_page INTEGER UNSIGNED DEFAULT NULL,
+ log_comment_id BIGINT UNSIGNED NOT NULL,
+ log_params BLOB NOT NULL,
+ log_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ PRIMARY KEY(log_id)
+);
+
+
+INSERT INTO /*_*/logging_temp
+ SELECT log_id, log_type, log_action, log_timestamp, log_actor, log_namespace, log_title, log_page, log_comment_id, log_params, log_deleted
+ FROM /*_*/logging;
+DROP TABLE /*_*/logging;
+ALTER TABLE /*_*/logging_temp RENAME TO /*_*/logging;
+
+
+CREATE INDEX type_time ON /*_*/logging (log_type, log_timestamp);
+
+CREATE INDEX actor_time ON /*_*/logging (log_actor, log_timestamp);
+
+CREATE INDEX page_time ON /*_*/logging (
+ log_namespace, log_title, log_timestamp
+);
+
+CREATE INDEX times ON /*_*/logging (log_timestamp);
+
+CREATE INDEX log_actor_type_time ON /*_*/logging (
+ log_actor, log_type, log_timestamp
+);
+
+CREATE INDEX log_page_id_time ON /*_*/logging (log_page, log_timestamp);
+
+CREATE INDEX log_type_action ON /*_*/logging (
+ log_type, log_action, log_timestamp
+);
diff --git a/sql/sqlite/patch-logging-rename-indexes.sql b/sql/sqlite/patch-logging-rename-indexes.sql
new file mode 100644
index 000000000000..f2da25425437
--- /dev/null
+++ b/sql/sqlite/patch-logging-rename-indexes.sql
@@ -0,0 +1,27 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-logging-rename-indexes.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX type_time;
+DROP INDEX actor_time;
+DROP INDEX page_time;
+DROP INDEX times;
+DROP INDEX log_actor_type_time;
+DROP INDEX log_page_id_time;
+DROP INDEX log_type_action;
+CREATE TEMPORARY TABLE /*_*/__temp__logging AS
+SELECT log_id, log_type, log_action, log_timestamp, log_actor, log_namespace, log_title, log_page, log_comment_id, log_params, log_deleted
+FROM /*_*/logging;
+DROP TABLE /*_*/logging;
+CREATE TABLE /*_*/logging ( log_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, log_type BLOB DEFAULT '' NOT NULL, log_action BLOB DEFAULT '' NOT NULL, log_timestamp BLOB DEFAULT '19700101000000' NOT NULL, log_actor BIGINT UNSIGNED NOT NULL, log_namespace INTEGER DEFAULT 0 NOT NULL, log_title BLOB DEFAULT '' NOT NULL, log_page INTEGER UNSIGNED DEFAULT NULL, log_comment_id BIGINT UNSIGNED NOT NULL, log_params BLOB NOT NULL, log_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL );
+INSERT INTO /*_*/logging ( log_id, log_type, log_action, log_timestamp, log_actor, log_namespace, log_title, log_page, log_comment_id, log_params, log_deleted )
+SELECT log_id, log_type, log_action, log_timestamp, log_actor, log_namespace, log_title, log_page, log_comment_id, log_params, log_deleted
+FROM /*_*/__temp__logging;
+DROP TABLE /*_*/__temp__logging;
+CREATE INDEX log_actor_type_time ON /*_*/logging ( log_actor, log_type, log_timestamp );
+CREATE INDEX log_page_id_time ON /*_*/logging (log_page, log_timestamp);
+CREATE INDEX log_type_action ON /*_*/logging ( log_type, log_action, log_timestamp );
+CREATE INDEX log_type_time ON /*_*/logging (log_type, log_timestamp);
+CREATE INDEX log_actor_time ON /*_*/logging (log_actor, log_timestamp);
+CREATE INDEX log_page_time ON /*_*/logging ( log_namespace, log_title, log_timestamp );
+CREATE INDEX log_times ON /*_*/logging (log_timestamp); \ No newline at end of file
diff --git a/sql/sqlite/patch-objectcache-exptime-notnull.sql b/sql/sqlite/patch-objectcache-exptime-notnull.sql
new file mode 100644
index 000000000000..f0d939e01b24
--- /dev/null
+++ b/sql/sqlite/patch-objectcache-exptime-notnull.sql
@@ -0,0 +1,14 @@
+CREATE TABLE /*_*/objectcache_tmp (
+ keyname BLOB DEFAULT '' NOT NULL,
+ value BLOB DEFAULT NULL,
+ exptime BLOB NOT NULL,
+ PRIMARY KEY(keyname)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/objectcache_tmp(keyname, value, exptime)
+ SELECT keyname, value, exptime FROM /*_*/objectcache;
+
+DROP TABLE /*_*/objectcache;
+ALTER TABLE /*_*/objectcache_tmp RENAME TO /*_*/objectcache;
+
+CREATE INDEX exptime ON /*_*/objectcache (exptime);
diff --git a/sql/sqlite/patch-objectcache-modtoken.sql b/sql/sqlite/patch-objectcache-modtoken.sql
new file mode 100644
index 000000000000..df327813d3d3
--- /dev/null
+++ b/sql/sqlite/patch-objectcache-modtoken.sql
@@ -0,0 +1,8 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-objectcache-modtoken.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+ALTER TABLE /*_*/objectcache
+ADD COLUMN modtoken VARCHAR(17) DEFAULT '00000000000000000' NOT NULL;
+ALTER TABLE /*_*/objectcache
+ADD COLUMN flags INTEGER UNSIGNED DEFAULT NULL; \ No newline at end of file
diff --git a/sql/sqlite/patch-oldimage-oi_name-varbinary.sql b/sql/sqlite/patch-oldimage-oi_name-varbinary.sql
new file mode 100644
index 000000000000..a2b84736a693
--- /dev/null
+++ b/sql/sqlite/patch-oldimage-oi_name-varbinary.sql
@@ -0,0 +1,28 @@
+CREATE TABLE oldimage_tmp (
+ oi_name BLOB DEFAULT '' NOT NULL, oi_archive_name BLOB DEFAULT '' NOT NULL,
+ oi_size INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ oi_width INTEGER DEFAULT 0 NOT NULL,
+ oi_height INTEGER DEFAULT 0 NOT NULL,
+ oi_bits INTEGER DEFAULT 0 NOT NULL,
+ oi_description_id BIGINT UNSIGNED NOT NULL,
+ oi_actor BIGINT UNSIGNED NOT NULL,
+ oi_timestamp BLOB NOT NULL,
+ oi_metadata BLOB NOT NULL, oi_media_type TEXT DEFAULT NULL,
+ oi_major_mime TEXT DEFAULT 'unknown' NOT NULL,
+ oi_minor_mime BLOB DEFAULT 'unknown' NOT NULL,
+ oi_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ oi_sha1 BLOB DEFAULT '' NOT NULL
+);;
+INSERT INTO /*_*/oldimage_tmp (
+ oi_name, oi_archive_name,oi_size,oi_width,oi_height ,oi_bits ,oi_description_id ,oi_actor, 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_id ,oi_actor, 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 oi_actor_timestamp ON /*_*/oldimage (oi_actor, oi_timestamp);
+CREATE INDEX oi_name_timestamp ON /*_*/oldimage (oi_name, oi_timestamp);
+CREATE INDEX oi_name_archive_name ON /*_*/oldimage (oi_name, oi_archive_name);
+CREATE INDEX oi_sha1 ON /*_*/oldimage (oi_sha1);
diff --git a/sql/sqlite/patch-oldimage-oi_size_to_bigint.sql b/sql/sqlite/patch-oldimage-oi_size_to_bigint.sql
new file mode 100644
index 000000000000..b6c813821196
--- /dev/null
+++ b/sql/sqlite/patch-oldimage-oi_size_to_bigint.sql
@@ -0,0 +1,18 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: abstractSchemaChanges/patch-oldimage-oi_size_to_bigint.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TEMPORARY TABLE /*_*/__temp__oldimage AS
+SELECT oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, oi_description_id, oi_actor, oi_timestamp, oi_metadata, oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1
+FROM /*_*/oldimage;
+DROP TABLE /*_*/oldimage;
+CREATE TABLE /*_*/oldimage ( oi_name BLOB DEFAULT '' NOT NULL, oi_archive_name BLOB DEFAULT '' NOT NULL, oi_size BIGINT UNSIGNED DEFAULT 0 NOT NULL, oi_width INTEGER DEFAULT 0 NOT NULL, oi_height INTEGER DEFAULT 0 NOT NULL, oi_bits INTEGER DEFAULT 0 NOT NULL, oi_description_id BIGINT UNSIGNED NOT NULL, oi_actor BIGINT UNSIGNED NOT NULL, oi_timestamp BLOB NOT NULL, oi_metadata BLOB NOT NULL, oi_media_type TEXT DEFAULT NULL, oi_major_mime TEXT DEFAULT 'unknown' NOT NULL, oi_minor_mime BLOB DEFAULT 'unknown' NOT NULL, oi_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL, oi_sha1 BLOB DEFAULT '' NOT NULL );
+INSERT INTO /*_*/oldimage ( oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, oi_description_id, oi_actor, 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_id, oi_actor, oi_timestamp, oi_metadata, oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1
+FROM /*_*/__temp__oldimage;
+DROP TABLE /*_*/__temp__oldimage;
+CREATE INDEX oi_actor_timestamp ON /*_*/oldimage (oi_actor, oi_timestamp);
+CREATE INDEX oi_name_timestamp ON /*_*/oldimage (oi_name, oi_timestamp);
+CREATE INDEX oi_name_archive_name ON /*_*/oldimage (oi_name, oi_archive_name);
+CREATE INDEX oi_sha1 ON /*_*/oldimage (oi_sha1);
+CREATE INDEX oi_timestamp ON /*_*/oldimage (oi_timestamp); \ No newline at end of file
diff --git a/sql/sqlite/patch-oldimage-oi_timestamp.sql b/sql/sqlite/patch-oldimage-oi_timestamp.sql
new file mode 100644
index 000000000000..411a6f8ed277
--- /dev/null
+++ b/sql/sqlite/patch-oldimage-oi_timestamp.sql
@@ -0,0 +1,22 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-oldimage-oi_timestamp.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX oi_actor_timestamp;
+DROP INDEX oi_name_timestamp;
+DROP INDEX oi_name_archive_name;
+DROP INDEX oi_sha1;
+CREATE TEMPORARY TABLE /*_*/__temp__oldimage AS
+SELECT oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, oi_description_id, oi_actor, oi_timestamp, oi_metadata, oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1
+FROM /*_*/oldimage;
+DROP TABLE /*_*/oldimage;
+CREATE TABLE /*_*/oldimage ( oi_name BLOB DEFAULT '' NOT NULL, oi_archive_name BLOB DEFAULT '' NOT NULL, oi_size INTEGER UNSIGNED DEFAULT 0 NOT NULL, oi_width INTEGER DEFAULT 0 NOT NULL, oi_height INTEGER DEFAULT 0 NOT NULL, oi_bits INTEGER DEFAULT 0 NOT NULL, oi_description_id BIGINT UNSIGNED NOT NULL, oi_actor BIGINT UNSIGNED NOT NULL, oi_timestamp BLOB NOT NULL, oi_metadata BLOB NOT NULL, oi_media_type TEXT DEFAULT NULL, oi_major_mime TEXT DEFAULT 'unknown' NOT NULL, oi_minor_mime BLOB DEFAULT 'unknown' NOT NULL, oi_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL, oi_sha1 BLOB DEFAULT '' NOT NULL );
+INSERT INTO /*_*/oldimage ( oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, oi_description_id, oi_actor, 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_id, oi_actor, oi_timestamp, oi_metadata, oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1
+FROM /*_*/__temp__oldimage;
+DROP TABLE /*_*/__temp__oldimage;
+CREATE INDEX oi_actor_timestamp ON /*_*/oldimage (oi_actor, oi_timestamp);
+CREATE INDEX oi_name_timestamp ON /*_*/oldimage (oi_name, oi_timestamp);
+CREATE INDEX oi_name_archive_name ON /*_*/oldimage (oi_name, oi_archive_name);
+CREATE INDEX oi_sha1 ON /*_*/oldimage (oi_sha1);
+CREATE INDEX oi_timestamp ON /*_*/oldimage (oi_timestamp); \ No newline at end of file
diff --git a/sql/sqlite/patch-page-drop-page_restrictions.sql b/sql/sqlite/patch-page-drop-page_restrictions.sql
new file mode 100644
index 000000000000..6b033808ef05
--- /dev/null
+++ b/sql/sqlite/patch-page-drop-page_restrictions.sql
@@ -0,0 +1,21 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-page-drop-page_restrictions.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX page_name_title;
+DROP INDEX page_random;
+DROP INDEX page_len;
+DROP INDEX page_redirect_namespace_len;
+CREATE TEMPORARY TABLE /*_*/__temp__page AS
+SELECT page_id, page_namespace, page_title, page_is_redirect, page_is_new, page_random, page_touched, page_links_updated, page_latest, page_len, page_content_model, page_lang
+FROM /*_*/page;
+DROP TABLE /*_*/page;
+CREATE TABLE /*_*/page ( page_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, page_namespace INTEGER NOT NULL, page_title BLOB NOT NULL, page_is_redirect SMALLINT UNSIGNED DEFAULT 0 NOT NULL, page_is_new SMALLINT UNSIGNED DEFAULT 0 NOT NULL, page_random DOUBLE PRECISION NOT NULL, page_touched BLOB NOT NULL, page_links_updated BLOB DEFAULT NULL, page_latest INTEGER UNSIGNED NOT NULL, page_len INTEGER UNSIGNED NOT NULL, page_content_model BLOB DEFAULT NULL, page_lang BLOB DEFAULT NULL );
+INSERT INTO /*_*/page ( page_id, page_namespace, page_title, page_is_redirect, page_is_new, page_random, page_touched, page_links_updated, page_latest, page_len, page_content_model, page_lang )
+SELECT page_id, page_namespace, page_title, page_is_redirect, page_is_new, page_random, page_touched, page_links_updated, page_latest, page_len, page_content_model, page_lang
+FROM /*_*/__temp__page;
+DROP TABLE /*_*/__temp__page;
+CREATE UNIQUE INDEX page_name_title ON /*_*/page (page_namespace, page_title);
+CREATE INDEX page_random ON /*_*/page (page_random);
+CREATE INDEX page_len ON /*_*/page (page_len);
+CREATE INDEX page_redirect_namespace_len ON /*_*/page ( page_is_redirect, page_namespace, page_len ); \ No newline at end of file
diff --git a/sql/sqlite/patch-page-page_title-varbinary.sql b/sql/sqlite/patch-page-page_title-varbinary.sql
new file mode 100644
index 000000000000..4f4af774351b
--- /dev/null
+++ b/sql/sqlite/patch-page-page_title-varbinary.sql
@@ -0,0 +1,33 @@
+CREATE TABLE /*_*/page_tmp (
+ page_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ page_namespace INTEGER NOT NULL,
+ page_title BLOB NOT NULL,
+ page_is_redirect SMALLINT DEFAULT 0 NOT NULL,
+ page_is_new SMALLINT DEFAULT 0 NOT NULL,
+ page_random DOUBLE PRECISION NOT NULL,
+ page_touched BLOB NOT NULL,
+ page_links_updated BLOB DEFAULT NULL,
+ page_latest INTEGER UNSIGNED NOT NULL,
+ page_len INTEGER UNSIGNED NOT NULL,
+ page_content_model BLOB DEFAULT NULL,
+ page_lang BLOB DEFAULT NULL
+);
+
+
+INSERT INTO /*_*/page_tmp
+ SELECT page_id, page_namespace, page_title, page_is_redirect, page_is_new,
+ page_random, page_touched, page_links_updated, page_latest, page_len, page_content_model, page_lang
+ FROM /*_*/page;
+DROP TABLE /*_*/page;
+ALTER TABLE /*_*/page_tmp RENAME TO /*_*/page;
+
+CREATE UNIQUE INDEX name_title ON /*_*/page (page_namespace, page_title);
+
+CREATE INDEX page_random ON /*_*/page (page_random);
+
+CREATE INDEX page_len ON /*_*/page (page_len);
+
+CREATE INDEX page_redirect_namespace_len ON /*_*/page (
+ page_is_redirect, page_namespace,
+ page_len
+);
diff --git a/sql/sqlite/patch-page-rename-name_title-index.sql b/sql/sqlite/patch-page-rename-name_title-index.sql
new file mode 100644
index 000000000000..d1f2f1ff1bae
--- /dev/null
+++ b/sql/sqlite/patch-page-rename-name_title-index.sql
@@ -0,0 +1,21 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-page-rename-name_title-index.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX name_title;
+DROP INDEX page_random;
+DROP INDEX page_len;
+DROP INDEX page_redirect_namespace_len;
+CREATE TEMPORARY TABLE /*_*/__temp__page AS
+SELECT page_id, page_namespace, page_title, page_is_redirect, page_is_new, page_random, page_touched, page_links_updated, page_latest, page_len, page_content_model, page_lang
+FROM /*_*/page;
+DROP TABLE /*_*/page;
+CREATE TABLE /*_*/page ( page_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, page_namespace INTEGER NOT NULL, page_title BLOB NOT NULL, page_is_redirect SMALLINT DEFAULT 0 NOT NULL, page_is_new SMALLINT DEFAULT 0 NOT NULL, page_random DOUBLE PRECISION NOT NULL, page_touched BLOB NOT NULL, page_links_updated BLOB DEFAULT NULL, page_latest INTEGER UNSIGNED NOT NULL, page_len INTEGER UNSIGNED NOT NULL, page_content_model BLOB DEFAULT NULL, page_lang BLOB DEFAULT NULL );
+INSERT INTO /*_*/page ( page_id, page_namespace, page_title, page_is_redirect, page_is_new, page_random, page_touched, page_links_updated, page_latest, page_len, page_content_model, page_lang )
+SELECT page_id, page_namespace, page_title, page_is_redirect, page_is_new, page_random, page_touched, page_links_updated, page_latest, page_len, page_content_model, page_lang
+FROM /*_*/__temp__page;
+DROP TABLE /*_*/__temp__page;
+CREATE INDEX page_random ON /*_*/page (page_random);
+CREATE INDEX page_len ON /*_*/page (page_len);
+CREATE INDEX page_redirect_namespace_len ON /*_*/page ( page_is_redirect, page_namespace, page_len );
+CREATE UNIQUE INDEX page_name_title ON /*_*/page (page_namespace, page_title);
diff --git a/sql/sqlite/patch-page_props-pp_page.sql b/sql/sqlite/patch-page_props-pp_page.sql
new file mode 100644
index 000000000000..b69252ac4a66
--- /dev/null
+++ b/sql/sqlite/patch-page_props-pp_page.sql
@@ -0,0 +1,17 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-page_props-pp_page.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX pp_propname_page;
+DROP INDEX pp_propname_sortkey_page;
+CREATE TEMPORARY TABLE /*_*/__temp__page_props AS
+SELECT pp_page, pp_propname, pp_value, pp_sortkey
+FROM /*_*/page_props;
+DROP TABLE /*_*/page_props;
+CREATE TABLE /*_*/page_props ( pp_page INTEGER UNSIGNED NOT NULL, pp_propname BLOB NOT NULL, pp_value BLOB NOT NULL, pp_sortkey DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(pp_page, pp_propname) );
+INSERT INTO /*_*/page_props ( pp_page, pp_propname, pp_value, pp_sortkey )
+SELECT pp_page, pp_propname, pp_value, pp_sortkey
+FROM /*_*/__temp__page_props;
+DROP TABLE /*_*/__temp__page_props;
+CREATE UNIQUE INDEX pp_propname_page ON /*_*/page_props (pp_propname, pp_page);
+CREATE UNIQUE INDEX pp_propname_sortkey_page ON /*_*/page_props (pp_propname, pp_sortkey, pp_page); \ No newline at end of file
diff --git a/sql/sqlite/patch-page_restrictions-pr_page.sql b/sql/sqlite/patch-page_restrictions-pr_page.sql
new file mode 100644
index 000000000000..e215c1c3b78e
--- /dev/null
+++ b/sql/sqlite/patch-page_restrictions-pr_page.sql
@@ -0,0 +1,21 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-page_restrictions-pr_page.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX pr_pagetype;
+DROP INDEX pr_typelevel;
+DROP INDEX pr_level;
+DROP INDEX pr_cascade;
+CREATE TEMPORARY TABLE /*_*/__temp__page_restrictions AS
+SELECT pr_id, pr_page, pr_type, pr_level, pr_cascade, pr_expiry
+FROM /*_*/page_restrictions;
+DROP TABLE /*_*/page_restrictions;
+CREATE TABLE /*_*/page_restrictions ( pr_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, pr_page INTEGER UNSIGNED NOT NULL, pr_type BLOB NOT NULL, pr_level BLOB NOT NULL, pr_cascade SMALLINT NOT NULL, pr_expiry BLOB DEFAULT NULL );
+INSERT INTO /*_*/page_restrictions ( pr_id, pr_page, pr_type, pr_level, pr_cascade, pr_expiry )
+SELECT pr_id, pr_page, pr_type, pr_level, pr_cascade, pr_expiry
+FROM /*_*/__temp__page_restrictions;
+DROP TABLE /*_*/__temp__page_restrictions;
+CREATE UNIQUE INDEX pr_pagetype ON /*_*/page_restrictions (pr_page, pr_type);
+CREATE INDEX pr_typelevel ON /*_*/page_restrictions (pr_type, pr_level);
+CREATE INDEX pr_level ON /*_*/page_restrictions (pr_level);
+CREATE INDEX pr_cascade ON /*_*/page_restrictions (pr_cascade); \ No newline at end of file
diff --git a/sql/sqlite/patch-pagelinks-drop-pl_title.sql b/sql/sqlite/patch-pagelinks-drop-pl_title.sql
new file mode 100644
index 000000000000..9f2840e8c3ec
--- /dev/null
+++ b/sql/sqlite/patch-pagelinks-drop-pl_title.sql
@@ -0,0 +1,36 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-pagelinks-drop-pl_title.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TEMPORARY TABLE /*_*/__temp__pagelinks AS
+SELECT
+ pl_from,
+ pl_from_namespace,
+ pl_target_id
+FROM /*_*/pagelinks;
+DROP TABLE /*_*/pagelinks;
+
+
+CREATE TABLE /*_*/pagelinks (
+ pl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ pl_target_id BIGINT UNSIGNED NOT NULL,
+ pl_from_namespace INTEGER DEFAULT 0 NOT NULL,
+ PRIMARY KEY(pl_from, pl_target_id)
+ );
+INSERT INTO /*_*/pagelinks (
+ pl_from, pl_from_namespace, pl_target_id
+ )
+SELECT
+ pl_from,
+ pl_from_namespace,
+ pl_target_id
+FROM
+ /*_*/__temp__pagelinks;
+DROP TABLE /*_*/__temp__pagelinks;
+
+CREATE INDEX pl_target_id ON /*_*/pagelinks (pl_target_id, pl_from);
+
+CREATE INDEX pl_backlinks_namespace_target_id ON /*_*/pagelinks (
+ pl_from_namespace, pl_target_id,
+ pl_from
+ );
diff --git a/sql/sqlite/patch-pagelinks-pl_title-varbinary.sql b/sql/sqlite/patch-pagelinks-pl_title-varbinary.sql
new file mode 100644
index 000000000000..c023ce0d6c1d
--- /dev/null
+++ b/sql/sqlite/patch-pagelinks-pl_title-varbinary.sql
@@ -0,0 +1,19 @@
+CREATE TABLE /*_*/pagelinks_tmp (
+ pl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ pl_namespace INTEGER DEFAULT 0 NOT NULL,
+ pl_title BLOB DEFAULT '' NOT NULL,
+ pl_from_namespace INTEGER DEFAULT 0 NOT NULL,
+ PRIMARY KEY(pl_from, pl_namespace, pl_title)
+);
+
+INSERT INTO /*_*/pagelinks_tmp
+ SELECT pl_from, pl_namespace, pl_title, pl_from_namespace
+ FROM /*_*/pagelinks;
+DROP TABLE /*_*/pagelinks;
+ALTER TABLE /*_*/pagelinks_tmp RENAME TO /*_*/pagelinks;
+
+CREATE INDEX pl_namespace ON /*_*/pagelinks (pl_namespace, pl_title, pl_from);
+CREATE INDEX pl_backlinks_namespace ON /*_*/pagelinks (
+ pl_from_namespace, pl_namespace,
+ pl_title, pl_from
+);
diff --git a/sql/sqlite/patch-pagelinks-target_id.sql b/sql/sqlite/patch-pagelinks-target_id.sql
new file mode 100644
index 000000000000..d8e80ca85913
--- /dev/null
+++ b/sql/sqlite/patch-pagelinks-target_id.sql
@@ -0,0 +1,17 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-pagelinks-target_id.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TEMPORARY TABLE /*_*/__temp__pagelinks AS
+SELECT pl_from, pl_namespace, pl_title, pl_from_namespace
+FROM /*_*/pagelinks;
+DROP TABLE /*_*/pagelinks;
+CREATE TABLE /*_*/pagelinks ( pl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL, pl_namespace INTEGER DEFAULT 0 NOT NULL, pl_title BLOB DEFAULT '' NOT NULL, pl_from_namespace INTEGER DEFAULT 0 NOT NULL, pl_target_id BIGINT UNSIGNED DEFAULT NULL, PRIMARY KEY(pl_from, pl_namespace, pl_title) );
+INSERT INTO /*_*/pagelinks ( pl_from, pl_namespace, pl_title, pl_from_namespace )
+SELECT pl_from, pl_namespace, pl_title, pl_from_namespace
+FROM /*_*/__temp__pagelinks;
+DROP TABLE /*_*/__temp__pagelinks;
+CREATE INDEX pl_namespace ON /*_*/pagelinks (pl_namespace, pl_title, pl_from);
+CREATE INDEX pl_backlinks_namespace ON /*_*/pagelinks ( pl_from_namespace, pl_namespace, pl_title, pl_from );
+CREATE INDEX pl_target_id ON /*_*/pagelinks (pl_target_id, pl_from);
+CREATE INDEX pl_backlinks_namespace_target_id ON /*_*/pagelinks ( pl_from_namespace, pl_target_id, pl_from ); \ No newline at end of file
diff --git a/sql/sqlite/patch-protected_titles-pt_expiry-drop-default.sql b/sql/sqlite/patch-protected_titles-pt_expiry-drop-default.sql
new file mode 100644
index 000000000000..b3b108379847
--- /dev/null
+++ b/sql/sqlite/patch-protected_titles-pt_expiry-drop-default.sql
@@ -0,0 +1,19 @@
+CREATE TABLE /*_*/protected_titles_tmp (
+ pt_namespace INTEGER NOT NULL,
+ pt_title BLOB NOT NULL,
+ pt_user INTEGER UNSIGNED NOT NULL,
+ pt_reason_id BIGINT UNSIGNED NOT NULL,
+ pt_timestamp BLOB NOT NULL,
+ pt_expiry BLOB NOT NULL,
+ pt_create_perm BLOB NOT NULL,
+ PRIMARY KEY(pt_namespace, pt_title)
+);
+
+
+INSERT INTO /*_*/protected_titles_tmp
+ SELECT pt_namespace, pt_title, pt_user, pt_reason_id, pt_timestamp, pt_expiry, pt_create_perm
+ FROM /*_*/protected_titles;
+DROP TABLE /*_*/protected_titles;
+ALTER TABLE /*_*/protected_titles_tmp RENAME TO /*_*/protected_titles;
+
+CREATE INDEX pt_timestamp ON /*_*/protected_titles (pt_timestamp);
diff --git a/sql/sqlite/patch-protected_titles-pt_title-varbinary.sql b/sql/sqlite/patch-protected_titles-pt_title-varbinary.sql
new file mode 100644
index 000000000000..ce8e9539f803
--- /dev/null
+++ b/sql/sqlite/patch-protected_titles-pt_title-varbinary.sql
@@ -0,0 +1,19 @@
+CREATE TABLE /*_*/protected_titles_tmp (
+ pt_namespace INTEGER NOT NULL,
+ pt_title BLOB NOT NULL,
+ pt_user INTEGER UNSIGNED NOT NULL,
+ pt_reason_id BIGINT UNSIGNED NOT NULL,
+ pt_timestamp BLOB NOT NULL,
+ pt_expiry BLOB DEFAULT '' NOT NULL,
+ pt_create_perm BLOB NOT NULL,
+ PRIMARY KEY(pt_namespace, pt_title)
+);
+
+
+INSERT INTO /*_*/protected_titles_tmp
+ SELECT pt_namespace, pt_title, pt_user, pt_reason_id, pt_timestamp, pt_expiry, pt_create_perm
+ FROM /*_*/protected_titles;
+DROP TABLE /*_*/protected_titles;
+ALTER TABLE /*_*/protected_titles_tmp RENAME TO /*_*/protected_titles;
+
+CREATE INDEX pt_timestamp ON /*_*/protected_titles (pt_timestamp); \ No newline at end of file
diff --git a/sql/sqlite/patch-querycache-qc_title-varbinary.sql b/sql/sqlite/patch-querycache-qc_title-varbinary.sql
new file mode 100644
index 000000000000..25631926a26d
--- /dev/null
+++ b/sql/sqlite/patch-querycache-qc_title-varbinary.sql
@@ -0,0 +1,14 @@
+CREATE TABLE /*_*/querycache_tmp (
+ qc_type BLOB NOT NULL,
+ qc_value INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ qc_namespace INTEGER DEFAULT 0 NOT NULL,
+ qc_title BLOB DEFAULT '' NOT NULL
+);
+
+INSERT INTO /*_*/querycache_tmp
+ SELECT qc_type, qc_value, qc_namespace, qc_title
+ FROM /*_*/querycache;
+DROP TABLE /*_*/querycache;
+ALTER TABLE /*_*/querycache_tmp RENAME TO /*_*/querycache;
+
+CREATE INDEX qc_type ON /*_*/querycache (qc_type, qc_value);
diff --git a/sql/sqlite/patch-querycachetwo-qcc_title-varbinary.sql b/sql/sqlite/patch-querycachetwo-qcc_title-varbinary.sql
new file mode 100644
index 000000000000..c390cf7e62fa
--- /dev/null
+++ b/sql/sqlite/patch-querycachetwo-qcc_title-varbinary.sql
@@ -0,0 +1,24 @@
+CREATE TABLE /*_*/querycachetwo_tmp (
+ qcc_type BLOB NOT NULL,
+ qcc_value INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ qcc_namespace INTEGER DEFAULT 0 NOT NULL,
+ qcc_title BLOB DEFAULT '' NOT NULL,
+ qcc_namespacetwo INTEGER DEFAULT 0 NOT NULL,
+ qcc_titletwo BLOB DEFAULT '' NOT NULL
+);
+
+INSERT INTO /*_*/querycachetwo_tmp
+ SELECT qcc_type, qcc_value, qcc_namespace, qcc_title, qcc_namespacetwo, qcc_titletwo
+ FROM /*_*/querycachetwo;
+DROP TABLE /*_*/querycachetwo;
+ALTER TABLE /*_*/querycachetwo_tmp RENAME TO /*_*/querycachetwo;
+
+CREATE INDEX qcc_type ON /*_*/querycachetwo (qcc_type, qcc_value);
+
+CREATE INDEX qcc_title ON /*_*/querycachetwo (
+ qcc_type, qcc_namespace, qcc_title
+);
+
+CREATE INDEX qcc_titletwo ON /*_*/querycachetwo (
+ qcc_type, qcc_namespacetwo, qcc_titletwo
+);
diff --git a/sql/sqlite/patch-recentchanges-rc_new_name_timestamp.sql b/sql/sqlite/patch-recentchanges-rc_new_name_timestamp.sql
new file mode 100644
index 000000000000..3acbb592ad36
--- /dev/null
+++ b/sql/sqlite/patch-recentchanges-rc_new_name_timestamp.sql
@@ -0,0 +1,31 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-recentchanges-rc_new_name_timestamp.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX rc_timestamp;
+DROP INDEX rc_namespace_title_timestamp;
+DROP INDEX rc_cur_id;
+DROP INDEX new_name_timestamp;
+DROP INDEX rc_ip;
+DROP INDEX rc_ns_actor;
+DROP INDEX rc_actor;
+DROP INDEX rc_name_type_patrolled_timestamp;
+DROP INDEX rc_this_oldid;
+CREATE TEMPORARY TABLE /*_*/__temp__recentchanges AS
+SELECT rc_id, rc_timestamp, rc_actor, rc_namespace, rc_title, rc_comment_id, rc_minor, rc_bot, rc_new, rc_cur_id, rc_this_oldid, rc_last_oldid, rc_type, rc_source, rc_patrolled, rc_ip, rc_old_len, rc_new_len, rc_deleted, rc_logid, rc_log_type, rc_log_action, rc_params
+FROM /*_*/recentchanges;
+DROP TABLE /*_*/recentchanges;
+CREATE TABLE /*_*/recentchanges ( rc_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, rc_timestamp BLOB NOT NULL, rc_actor BIGINT UNSIGNED NOT NULL, rc_namespace INTEGER DEFAULT 0 NOT NULL, rc_title BLOB DEFAULT '' NOT NULL, rc_comment_id BIGINT UNSIGNED NOT NULL, rc_minor SMALLINT UNSIGNED DEFAULT 0 NOT NULL, rc_bot SMALLINT UNSIGNED DEFAULT 0 NOT NULL, rc_new SMALLINT UNSIGNED DEFAULT 0 NOT NULL, rc_cur_id INTEGER UNSIGNED DEFAULT 0 NOT NULL, rc_this_oldid INTEGER UNSIGNED DEFAULT 0 NOT NULL, rc_last_oldid INTEGER UNSIGNED DEFAULT 0 NOT NULL, rc_type SMALLINT UNSIGNED DEFAULT 0 NOT NULL, rc_source BLOB DEFAULT '' NOT NULL, rc_patrolled SMALLINT UNSIGNED DEFAULT 0 NOT NULL, rc_ip BLOB DEFAULT '' NOT NULL, rc_old_len INTEGER DEFAULT NULL, rc_new_len INTEGER DEFAULT NULL, rc_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL, rc_logid INTEGER UNSIGNED DEFAULT 0 NOT NULL, rc_log_type BLOB DEFAULT NULL, rc_log_action BLOB DEFAULT NULL, rc_params BLOB DEFAULT NULL );
+INSERT INTO /*_*/recentchanges ( rc_id, rc_timestamp, rc_actor, rc_namespace, rc_title, rc_comment_id, rc_minor, rc_bot, rc_new, rc_cur_id, rc_this_oldid, rc_last_oldid, rc_type, rc_source, rc_patrolled, rc_ip, rc_old_len, rc_new_len, rc_deleted, rc_logid, rc_log_type, rc_log_action, rc_params )
+SELECT rc_id, rc_timestamp, rc_actor, rc_namespace, rc_title, rc_comment_id, rc_minor, rc_bot, rc_new, rc_cur_id, rc_this_oldid, rc_last_oldid, rc_type, rc_source, rc_patrolled, rc_ip, rc_old_len, rc_new_len, rc_deleted, rc_logid, rc_log_type, rc_log_action, rc_params
+FROM /*_*/__temp__recentchanges;
+DROP TABLE /*_*/__temp__recentchanges;
+CREATE INDEX rc_timestamp ON /*_*/recentchanges (rc_timestamp);
+CREATE INDEX rc_namespace_title_timestamp ON /*_*/recentchanges ( rc_namespace, rc_title, rc_timestamp );
+CREATE INDEX rc_cur_id ON /*_*/recentchanges (rc_cur_id);
+CREATE INDEX rc_ip ON /*_*/recentchanges (rc_ip);
+CREATE INDEX rc_ns_actor ON /*_*/recentchanges (rc_namespace, rc_actor);
+CREATE INDEX rc_actor ON /*_*/recentchanges (rc_actor, rc_timestamp);
+CREATE INDEX rc_name_type_patrolled_timestamp ON /*_*/recentchanges ( rc_namespace, rc_type, rc_patrolled, rc_timestamp );
+CREATE INDEX rc_this_oldid ON /*_*/recentchanges (rc_this_oldid);
+CREATE INDEX rc_new_name_timestamp ON /*_*/recentchanges ( rc_new, rc_namespace, rc_timestamp ); \ No newline at end of file
diff --git a/sql/sqlite/patch-recentchanges-rc_title-varbinary.sql b/sql/sqlite/patch-recentchanges-rc_title-varbinary.sql
new file mode 100644
index 000000000000..1c781d4842d2
--- /dev/null
+++ b/sql/sqlite/patch-recentchanges-rc_title-varbinary.sql
@@ -0,0 +1,48 @@
+CREATE TABLE recentchanges_tmp (
+ rc_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ rc_timestamp BLOB NOT NULL, rc_actor BIGINT UNSIGNED NOT NULL,
+ rc_namespace INTEGER DEFAULT 0 NOT NULL,
+ rc_title BLOB DEFAULT '' NOT NULL, rc_comment_id BIGINT UNSIGNED NOT NULL,
+ rc_minor SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rc_bot SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rc_new SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rc_cur_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ rc_this_oldid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ rc_last_oldid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ rc_type SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rc_source BLOB DEFAULT '' NOT NULL,
+ rc_patrolled SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rc_ip BLOB DEFAULT '' NOT NULL, rc_old_len INTEGER DEFAULT NULL,
+ rc_new_len INTEGER DEFAULT NULL, rc_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rc_logid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ rc_log_type BLOB DEFAULT NULL, rc_log_action BLOB DEFAULT NULL,
+ rc_params BLOB DEFAULT NULL
+);
+INSERT INTO /*_*/recentchanges_tmp (
+ rc_id, rc_timestamp, rc_actor, rc_namespace, rc_title, rc_comment_id, rc_minor, rc_bot, rc_new, rc_cur_id,
+ rc_this_oldid, rc_last_oldid, rc_type, rc_source, rc_patrolled, rc_ip, rc_old_len, rc_new_len, rc_deleted,
+ rc_logid, rc_log_type, rc_log_action, rc_params)
+SELECT rc_id, rc_timestamp, rc_actor, rc_namespace, rc_title, rc_comment_id, rc_minor, rc_bot, rc_new, rc_cur_id,
+ rc_this_oldid, rc_last_oldid, rc_type, rc_source, rc_patrolled, rc_ip, rc_old_len, rc_new_len, rc_deleted,
+ rc_logid, rc_log_type, rc_log_action, rc_params
+FROM /*_*/recentchanges;
+DROP TABLE /*_*/recentchanges;
+ALTER TABLE /*_*/recentchanges_tmp RENAME TO /*_*/recentchanges;
+
+
+CREATE INDEX rc_timestamp ON /*_*/recentchanges (rc_timestamp);
+CREATE INDEX rc_namespace_title_timestamp ON /*_*/recentchanges (
+ rc_namespace, rc_title, rc_timestamp
+);
+CREATE INDEX rc_cur_id ON /*_*/recentchanges (rc_cur_id);
+CREATE INDEX new_name_timestamp ON /*_*/recentchanges (
+ rc_new, rc_namespace, rc_timestamp
+);
+CREATE INDEX rc_ip ON /*_*/recentchanges (rc_ip);
+CREATE INDEX rc_ns_actor ON /*_*/recentchanges (rc_namespace, rc_actor);
+CREATE INDEX rc_actor ON /*_*/recentchanges (rc_actor, rc_timestamp);
+CREATE INDEX rc_name_type_patrolled_timestamp ON /*_*/recentchanges (
+ rc_namespace, rc_type, rc_patrolled,
+ rc_timestamp
+);
+CREATE INDEX rc_this_oldid ON /*_*/recentchanges (rc_this_oldid);
diff --git a/sql/sqlite/patch-redirect-rd_title-varbinary.sql b/sql/sqlite/patch-redirect-rd_title-varbinary.sql
new file mode 100644
index 000000000000..7f937500542a
--- /dev/null
+++ b/sql/sqlite/patch-redirect-rd_title-varbinary.sql
@@ -0,0 +1,15 @@
+CREATE TABLE /*_*/redirect_tmp (
+ rd_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ rd_namespace INTEGER DEFAULT 0 NOT NULL,
+ rd_title BLOB DEFAULT '' NOT NULL,
+ rd_interwiki VARCHAR(32) DEFAULT NULL,
+ rd_fragment BLOB DEFAULT NULL,
+ PRIMARY KEY(rd_from)
+);
+INSERT INTO /*_*/redirect_tmp
+ SELECT rd_from, rd_namespace, rd_title, rd_interwiki, rd_fragment
+ FROM /*_*/redirect;
+DROP TABLE /*_*/redirect;
+ALTER TABLE /*_*/redirect_tmp RENAME TO /*_*/redirect;
+
+CREATE INDEX rd_ns_title ON /*_*/redirect (rd_namespace, rd_title, rd_from);
diff --git a/sql/sqlite/patch-revision-cleanup.sql b/sql/sqlite/patch-revision-cleanup.sql
new file mode 100644
index 000000000000..0b070f11a755
--- /dev/null
+++ b/sql/sqlite/patch-revision-cleanup.sql
@@ -0,0 +1,61 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-revision-cleanup.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TEMPORARY TABLE /*_*/__temp__revision AS
+SELECT
+ rev_id,
+ rev_page,
+ rev_comment_id,
+ rev_actor,
+ rev_timestamp,
+ rev_minor_edit,
+ rev_deleted,
+ rev_len,
+ rev_parent_id,
+ rev_sha1
+FROM /*_*/revision;
+DROP TABLE /*_*/revision;
+
+
+CREATE TABLE /*_*/revision (
+ rev_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ rev_page INTEGER UNSIGNED NOT NULL,
+ rev_comment_id BIGINT UNSIGNED NOT NULL,
+ rev_actor BIGINT UNSIGNED NOT NULL,
+ rev_timestamp BLOB NOT NULL, rev_minor_edit SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rev_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rev_len INTEGER UNSIGNED DEFAULT NULL,
+ rev_parent_id BIGINT UNSIGNED DEFAULT NULL,
+ rev_sha1 BLOB DEFAULT '' NOT NULL
+ );
+INSERT INTO /*_*/revision (
+ rev_id, rev_page, rev_comment_id,
+ rev_actor, rev_timestamp, rev_minor_edit,
+ rev_deleted, rev_len, rev_parent_id,
+ rev_sha1
+ )
+SELECT
+ rev_id,
+ rev_page,
+ rev_comment_id,
+ rev_actor,
+ rev_timestamp,
+ rev_minor_edit,
+ rev_deleted,
+ rev_len,
+ rev_parent_id,
+ rev_sha1
+FROM
+ /*_*/__temp__revision;
+DROP TABLE /*_*/__temp__revision;
+
+CREATE INDEX rev_timestamp ON /*_*/revision (rev_timestamp);
+
+CREATE INDEX rev_page_timestamp ON /*_*/revision (rev_page, rev_timestamp);
+
+CREATE INDEX rev_actor_timestamp ON /*_*/revision (rev_actor, rev_timestamp, rev_id);
+
+CREATE INDEX rev_page_actor_timestamp ON /*_*/revision (
+ rev_page, rev_actor, rev_timestamp
+ );
diff --git a/sql/sqlite/patch-revision-rename-index.sql b/sql/sqlite/patch-revision-rename-index.sql
new file mode 100644
index 000000000000..b21293fd2a43
--- /dev/null
+++ b/sql/sqlite/patch-revision-rename-index.sql
@@ -0,0 +1,23 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-revision-rename-index.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX rev_page_id;
+DROP INDEX rev_timestamp;
+DROP INDEX page_timestamp;
+DROP INDEX rev_actor_timestamp;
+DROP INDEX rev_page_actor_timestamp;
+CREATE TEMPORARY TABLE /*_*/__temp__revision AS
+SELECT rev_id, rev_page, rev_comment_id, rev_actor, rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id, rev_sha1
+FROM /*_*/revision;
+DROP TABLE /*_*/revision;
+CREATE TABLE /*_*/revision ( rev_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, rev_page INTEGER UNSIGNED NOT NULL, rev_comment_id BIGINT UNSIGNED DEFAULT 0 NOT NULL, rev_actor BIGINT UNSIGNED DEFAULT 0 NOT NULL, rev_timestamp BLOB DEFAULT '' NOT NULL, rev_minor_edit SMALLINT UNSIGNED DEFAULT 0 NOT NULL, rev_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL, rev_len INTEGER UNSIGNED DEFAULT NULL, rev_parent_id INTEGER UNSIGNED DEFAULT NULL, rev_sha1 BLOB DEFAULT '' NOT NULL );
+INSERT INTO /*_*/revision ( rev_id, rev_page, rev_comment_id, rev_actor, rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id, rev_sha1 )
+SELECT rev_id, rev_page, rev_comment_id, rev_actor, rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id, rev_sha1
+FROM /*_*/__temp__revision;
+DROP TABLE /*_*/__temp__revision;
+CREATE INDEX rev_page_id ON /*_*/revision (rev_page, rev_id);
+CREATE INDEX rev_timestamp ON /*_*/revision (rev_timestamp);
+CREATE INDEX rev_actor_timestamp ON /*_*/revision (rev_actor, rev_timestamp, rev_id);
+CREATE INDEX rev_page_actor_timestamp ON /*_*/revision ( rev_page, rev_actor, rev_timestamp );
+CREATE INDEX rev_page_timestamp ON /*_*/revision (rev_page, rev_timestamp); \ No newline at end of file
diff --git a/sql/sqlite/patch-revision-rev_timestamp-drop-default.sql b/sql/sqlite/patch-revision-rev_timestamp-drop-default.sql
new file mode 100644
index 000000000000..ad3da56e4643
--- /dev/null
+++ b/sql/sqlite/patch-revision-rev_timestamp-drop-default.sql
@@ -0,0 +1,26 @@
+CREATE TABLE /*_*/revision_tmp (
+ rev_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ rev_page INTEGER UNSIGNED NOT NULL,
+ rev_comment_id BIGINT UNSIGNED DEFAULT 0 NOT NULL,
+ rev_actor BIGINT UNSIGNED DEFAULT 0 NOT NULL,
+ rev_timestamp BLOB NOT NULL,
+ rev_minor_edit SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rev_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rev_len INTEGER UNSIGNED DEFAULT NULL,
+ rev_parent_id INTEGER UNSIGNED DEFAULT NULL,
+ rev_sha1 BLOB DEFAULT '' NOT NULL
+);
+
+INSERT INTO /*_*/revision_tmp
+ SELECT rev_id, rev_page, rev_comment_id, rev_actor, rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id, rev_sha1
+ FROM /*_*/revision;
+DROP TABLE /*_*/revision;
+ALTER TABLE /*_*/revision_tmp RENAME TO /*_*/revision;
+
+CREATE INDEX rev_page_id ON /*_*/revision (rev_page, rev_id);
+CREATE INDEX rev_timestamp ON /*_*/revision (rev_timestamp);
+CREATE INDEX rev_page_timestamp ON /*_*/revision (rev_page, rev_timestamp);
+CREATE INDEX rev_actor_timestamp ON /*_*/revision (rev_actor, rev_timestamp, rev_id);
+CREATE INDEX rev_page_actor_timestamp ON /*_*/revision (
+ rev_page, rev_actor, rev_timestamp
+);
diff --git a/sql/sqlite/patch-site_identifiers-rename-indexes.sql b/sql/sqlite/patch-site_identifiers-rename-indexes.sql
new file mode 100644
index 000000000000..e763a1faba02
--- /dev/null
+++ b/sql/sqlite/patch-site_identifiers-rename-indexes.sql
@@ -0,0 +1,17 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-site_identifiers-rename-indexes.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX site_ids_site;
+DROP INDEX site_ids_key;
+CREATE TEMPORARY TABLE /*_*/__temp__site_identifiers AS
+SELECT si_type, si_key, si_site
+FROM /*_*/site_identifiers;
+DROP TABLE /*_*/site_identifiers;
+CREATE TABLE /*_*/site_identifiers ( si_type BLOB NOT NULL, si_key BLOB NOT NULL, si_site INTEGER UNSIGNED NOT NULL, PRIMARY KEY(si_type, si_key) );
+INSERT INTO /*_*/site_identifiers (si_type, si_key, si_site)
+SELECT si_type, si_key, si_site
+FROM /*_*/__temp__site_identifiers;
+DROP TABLE /*_*/__temp__site_identifiers;
+CREATE INDEX si_site ON /*_*/site_identifiers (si_site);
+CREATE INDEX si_key ON /*_*/site_identifiers (si_key); \ No newline at end of file
diff --git a/sql/sqlite/patch-sites-drop_indexes.sql b/sql/sqlite/patch-sites-drop_indexes.sql
new file mode 100644
index 000000000000..1a92e6eec94f
--- /dev/null
+++ b/sql/sqlite/patch-sites-drop_indexes.sql
@@ -0,0 +1,57 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-sites-drop_indexes.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TEMPORARY TABLE /*_*/__temp__sites AS
+SELECT
+ site_id,
+ site_global_key,
+ site_type,
+ site_group,
+ site_source,
+ site_language,
+ site_protocol,
+ site_domain,
+ site_data,
+ site_forward,
+ site_config
+FROM /*_*/sites;
+DROP TABLE /*_*/sites;
+
+
+CREATE TABLE /*_*/sites (
+ site_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ site_global_key BLOB NOT NULL,
+ site_type BLOB NOT NULL,
+ site_group BLOB NOT NULL,
+ site_source BLOB NOT NULL,
+ site_language BLOB NOT NULL,
+ site_protocol BLOB NOT NULL,
+ site_domain VARCHAR(255) NOT NULL,
+ site_data BLOB NOT NULL,
+ site_forward SMALLINT NOT NULL,
+ site_config BLOB NOT NULL
+ );
+INSERT INTO /*_*/sites (
+ site_id, site_global_key, site_type,
+ site_group, site_source, site_language,
+ site_protocol, site_domain, site_data,
+ site_forward, site_config
+ )
+SELECT
+ site_id,
+ site_global_key,
+ site_type,
+ site_group,
+ site_source,
+ site_language,
+ site_protocol,
+ site_domain,
+ site_data,
+ site_forward,
+ site_config
+FROM
+ /*_*/__temp__sites;
+DROP TABLE /*_*/__temp__sites;
+
+CREATE UNIQUE INDEX site_global_key ON /*_*/sites (site_global_key);
diff --git a/sql/sqlite/patch-sites-rename-indexes.sql b/sql/sqlite/patch-sites-rename-indexes.sql
new file mode 100644
index 000000000000..fdd09f141339
--- /dev/null
+++ b/sql/sqlite/patch-sites-rename-indexes.sql
@@ -0,0 +1,29 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-sites-rename-indexes.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX sites_global_key;
+DROP INDEX sites_type;
+DROP INDEX sites_group;
+DROP INDEX sites_source;
+DROP INDEX sites_language;
+DROP INDEX sites_protocol;
+DROP INDEX sites_domain;
+DROP INDEX sites_forward;
+CREATE TEMPORARY TABLE /*_*/__temp__sites AS
+SELECT site_id, site_global_key, site_type, site_group, site_source, site_language, site_protocol, site_domain, site_data, site_forward, site_config
+FROM /*_*/sites;
+DROP TABLE /*_*/sites;
+CREATE TABLE /*_*/sites ( site_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, site_global_key BLOB NOT NULL, site_type BLOB NOT NULL, site_group BLOB NOT NULL, site_source BLOB NOT NULL, site_language BLOB NOT NULL, site_protocol BLOB NOT NULL, site_domain VARCHAR(255) NOT NULL, site_data BLOB NOT NULL, site_forward SMALLINT NOT NULL, site_config BLOB NOT NULL );
+INSERT INTO /*_*/sites ( site_id, site_global_key, site_type, site_group, site_source, site_language, site_protocol, site_domain, site_data, site_forward, site_config )
+SELECT site_id, site_global_key, site_type, site_group, site_source, site_language, site_protocol, site_domain, site_data, site_forward, site_config
+FROM /*_*/__temp__sites;
+DROP TABLE /*_*/__temp__sites;
+CREATE UNIQUE INDEX site_global_key ON /*_*/sites (site_global_key);
+CREATE INDEX site_type ON /*_*/sites (site_type);
+CREATE INDEX site_group ON /*_*/sites (site_group);
+CREATE INDEX site_source ON /*_*/sites (site_source);
+CREATE INDEX site_language ON /*_*/sites (site_language);
+CREATE INDEX site_protocol ON /*_*/sites (site_protocol);
+CREATE INDEX site_domain ON /*_*/sites (site_domain);
+CREATE INDEX site_forward ON /*_*/sites (site_forward); \ No newline at end of file
diff --git a/sql/sqlite/patch-slot_roles-role_id-fix_not_null.sql b/sql/sqlite/patch-slot_roles-role_id-fix_not_null.sql
new file mode 100644
index 000000000000..53f26e3a08af
--- /dev/null
+++ b/sql/sqlite/patch-slot_roles-role_id-fix_not_null.sql
@@ -0,0 +1,11 @@
+CREATE TABLE /*_*/slot_roles_tmp (
+ role_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ role_name BLOB NOT NULL
+);
+
+INSERT INTO /*_*/slot_roles_tmp
+ SELECT role_id, role_name
+ FROM /*_*/slot_roles;
+DROP TABLE /*_*/slot_roles;
+ALTER TABLE /*_*/slot_roles_tmp RENAME TO /*_*/slot_roles;
+CREATE UNIQUE INDEX role_name ON /*_*/slot_roles (role_name);
diff --git a/sql/sqlite/patch-templatelinks-drop-tl_title.sql b/sql/sqlite/patch-templatelinks-drop-tl_title.sql
new file mode 100644
index 000000000000..5bc26ae30893
--- /dev/null
+++ b/sql/sqlite/patch-templatelinks-drop-tl_title.sql
@@ -0,0 +1,19 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-templatelinks-drop-tl_title.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX tl_namespace;
+DROP INDEX tl_backlinks_namespace;
+DROP INDEX tl_target_id;
+DROP INDEX tl_backlinks_namespace_target_id;
+CREATE TEMPORARY TABLE /*_*/__temp__templatelinks AS
+SELECT tl_from, tl_target_id, tl_from_namespace
+FROM /*_*/templatelinks;
+DROP TABLE /*_*/templatelinks;
+CREATE TABLE /*_*/templatelinks ( tl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL, tl_target_id BIGINT UNSIGNED NOT NULL, tl_from_namespace INTEGER DEFAULT 0 NOT NULL, PRIMARY KEY(tl_from, tl_target_id) );
+INSERT INTO /*_*/templatelinks ( tl_from, tl_target_id, tl_from_namespace )
+SELECT tl_from, tl_target_id, tl_from_namespace
+FROM /*_*/__temp__templatelinks;
+DROP TABLE /*_*/__temp__templatelinks;
+CREATE INDEX tl_target_id ON /*_*/templatelinks (tl_target_id, tl_from);
+CREATE INDEX tl_backlinks_namespace_target_id ON /*_*/templatelinks ( tl_from_namespace, tl_target_id, tl_from ); \ No newline at end of file
diff --git a/sql/sqlite/patch-templatelinks-target_id.sql b/sql/sqlite/patch-templatelinks-target_id.sql
new file mode 100644
index 000000000000..d9e07830fdaa
--- /dev/null
+++ b/sql/sqlite/patch-templatelinks-target_id.sql
@@ -0,0 +1,19 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-templatelinks-target_id.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX tl_namespace;
+DROP INDEX tl_backlinks_namespace;
+CREATE TEMPORARY TABLE /*_*/__temp__templatelinks AS
+SELECT tl_from, tl_namespace, tl_title, tl_from_namespace
+FROM /*_*/templatelinks;
+DROP TABLE /*_*/templatelinks;
+CREATE TABLE /*_*/templatelinks ( tl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL, tl_namespace INTEGER DEFAULT 0 NOT NULL, tl_title BLOB DEFAULT '' NOT NULL, tl_from_namespace INTEGER DEFAULT 0 NOT NULL, tl_target_id BIGINT UNSIGNED DEFAULT NULL, PRIMARY KEY(tl_from, tl_namespace, tl_title) );
+INSERT INTO /*_*/templatelinks ( tl_from, tl_namespace, tl_title, tl_from_namespace )
+SELECT tl_from, tl_namespace, tl_title, tl_from_namespace
+FROM /*_*/__temp__templatelinks;
+DROP TABLE /*_*/__temp__templatelinks;
+CREATE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace, tl_title, tl_from);
+CREATE INDEX tl_backlinks_namespace ON /*_*/templatelinks ( tl_from_namespace, tl_namespace, tl_title, tl_from );
+CREATE INDEX tl_target_id ON /*_*/templatelinks (tl_target_id, tl_from);
+CREATE INDEX tl_backlinks_namespace_target_id ON /*_*/templatelinks ( tl_from_namespace, tl_target_id, tl_from ); \ No newline at end of file
diff --git a/sql/sqlite/patch-templatelinks-tl_title-nullable.sql b/sql/sqlite/patch-templatelinks-tl_title-nullable.sql
new file mode 100644
index 000000000000..0513f9e94637
--- /dev/null
+++ b/sql/sqlite/patch-templatelinks-tl_title-nullable.sql
@@ -0,0 +1,21 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-templatelinks-tl_title-nullable.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX tl_namespace;
+DROP INDEX tl_backlinks_namespace;
+DROP INDEX tl_target_id;
+DROP INDEX tl_backlinks_namespace_target_id;
+CREATE TEMPORARY TABLE /*_*/__temp__templatelinks AS
+SELECT tl_from, tl_namespace, tl_title, tl_from_namespace, tl_target_id
+FROM /*_*/templatelinks;
+DROP TABLE /*_*/templatelinks;
+CREATE TABLE /*_*/templatelinks ( tl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL, tl_target_id BIGINT UNSIGNED NOT NULL, tl_namespace INTEGER DEFAULT 0 NOT NULL, tl_title BLOB DEFAULT '' NOT NULL, tl_from_namespace INTEGER DEFAULT 0 NOT NULL, PRIMARY KEY(tl_from, tl_target_id) );
+INSERT INTO /*_*/templatelinks ( tl_from, tl_namespace, tl_title, tl_from_namespace, tl_target_id )
+SELECT tl_from, tl_namespace, tl_title, tl_from_namespace, tl_target_id
+FROM /*_*/__temp__templatelinks;
+DROP TABLE /*_*/__temp__templatelinks;
+CREATE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace, tl_title, tl_from);
+CREATE INDEX tl_backlinks_namespace ON /*_*/templatelinks ( tl_from_namespace, tl_namespace, tl_title, tl_from );
+CREATE INDEX tl_target_id ON /*_*/templatelinks (tl_target_id, tl_from);
+CREATE INDEX tl_backlinks_namespace_target_id ON /*_*/templatelinks ( tl_from_namespace, tl_target_id, tl_from ); \ No newline at end of file
diff --git a/sql/sqlite/patch-templatelinks-tl_title-varbinary.sql b/sql/sqlite/patch-templatelinks-tl_title-varbinary.sql
new file mode 100644
index 000000000000..60039678baee
--- /dev/null
+++ b/sql/sqlite/patch-templatelinks-tl_title-varbinary.sql
@@ -0,0 +1,20 @@
+CREATE TABLE /*_*/templatelinks_tmp (
+ tl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ tl_namespace INTEGER DEFAULT 0 NOT NULL,
+ tl_title BLOB DEFAULT '' NOT NULL,
+ tl_from_namespace INTEGER DEFAULT 0 NOT NULL,
+ PRIMARY KEY(tl_from, tl_namespace, tl_title)
+);
+
+INSERT INTO /*_*/templatelinks_tmp
+ SELECT tl_from, tl_namespace, tl_title, tl_from_namespace
+ FROM /*_*/templatelinks;
+DROP TABLE /*_*/templatelinks;
+ALTER TABLE /*_*/templatelinks_tmp RENAME TO /*_*/templatelinks;
+
+CREATE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace, tl_title, tl_from);
+
+CREATE INDEX tl_backlinks_namespace ON /*_*/templatelinks (
+ tl_from_namespace, tl_namespace,
+ tl_title, tl_from
+);
diff --git a/sql/sqlite/patch-uploadstash-us_size_to_bigint.sql b/sql/sqlite/patch-uploadstash-us_size_to_bigint.sql
new file mode 100644
index 000000000000..a760235d8c03
--- /dev/null
+++ b/sql/sqlite/patch-uploadstash-us_size_to_bigint.sql
@@ -0,0 +1,16 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: abstractSchemaChanges/patch-uploadstash-us_size_to_bigint.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TEMPORARY TABLE /*_*/__temp__uploadstash AS
+SELECT us_id, us_user, us_key, us_orig_path, us_path, us_source_type, us_timestamp, us_status, us_chunk_inx, us_props, us_size, us_sha1, us_mime, us_media_type, us_image_width, us_image_height, us_image_bits
+FROM /*_*/uploadstash;
+DROP TABLE /*_*/uploadstash;
+CREATE TABLE /*_*/uploadstash ( us_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, us_user INTEGER UNSIGNED NOT NULL, us_key VARCHAR(255) NOT NULL, us_orig_path VARCHAR(255) NOT NULL, us_path VARCHAR(255) NOT NULL, us_source_type VARCHAR(50) DEFAULT NULL, us_timestamp BLOB NOT NULL, us_status VARCHAR(50) NOT NULL, us_chunk_inx INTEGER UNSIGNED DEFAULT NULL, us_props BLOB DEFAULT NULL, us_size BIGINT UNSIGNED NOT NULL, us_sha1 VARCHAR(31) NOT NULL, us_mime VARCHAR(255) DEFAULT NULL, us_media_type TEXT DEFAULT NULL, us_image_width INTEGER UNSIGNED DEFAULT NULL, us_image_height INTEGER UNSIGNED DEFAULT NULL, us_image_bits SMALLINT UNSIGNED DEFAULT NULL );
+INSERT INTO /*_*/uploadstash ( us_id, us_user, us_key, us_orig_path, us_path, us_source_type, us_timestamp, us_status, us_chunk_inx, us_props, us_size, us_sha1, us_mime, us_media_type, us_image_width, us_image_height, us_image_bits )
+SELECT us_id, us_user, us_key, us_orig_path, us_path, us_source_type, us_timestamp, us_status, us_chunk_inx, us_props, us_size, us_sha1, us_mime, us_media_type, us_image_width, us_image_height, us_image_bits
+FROM /*_*/__temp__uploadstash;
+DROP TABLE /*_*/__temp__uploadstash;
+CREATE INDEX us_user ON /*_*/uploadstash (us_user);
+CREATE UNIQUE INDEX us_key ON /*_*/uploadstash (us_key);
+CREATE INDEX us_timestamp ON /*_*/uploadstash (us_timestamp); \ No newline at end of file
diff --git a/sql/sqlite/patch-user-user_editcount.sql b/sql/sqlite/patch-user-user_editcount.sql
new file mode 100644
index 000000000000..3264feb2db9b
--- /dev/null
+++ b/sql/sqlite/patch-user-user_editcount.sql
@@ -0,0 +1,19 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-user-user_editcount.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX user_name;
+DROP INDEX user_email_token;
+DROP INDEX user_email;
+CREATE TEMPORARY TABLE /*_*/__temp__user AS
+SELECT user_id, user_name, user_real_name, user_password, user_newpassword, user_newpass_time, user_email, user_touched, user_token, user_email_authenticated, user_email_token, user_email_token_expires, user_registration, user_editcount, user_password_expires
+FROM /*_*/user;
+DROP TABLE /*_*/user;
+CREATE TABLE /*_*/user ( user_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_name BLOB DEFAULT '' NOT NULL, user_real_name BLOB DEFAULT '' NOT NULL, user_password BLOB NOT NULL, user_newpassword BLOB NOT NULL, user_newpass_time BLOB DEFAULT NULL, user_email BLOB NOT NULL, user_touched BLOB NOT NULL, user_token BLOB DEFAULT '' NOT NULL, user_email_authenticated BLOB DEFAULT NULL, user_email_token BLOB DEFAULT NULL, user_email_token_expires BLOB DEFAULT NULL, user_registration BLOB DEFAULT NULL, user_editcount INTEGER UNSIGNED DEFAULT NULL, user_password_expires BLOB DEFAULT NULL );
+INSERT INTO /*_*/user ( user_id, user_name, user_real_name, user_password, user_newpassword, user_newpass_time, user_email, user_touched, user_token, user_email_authenticated, user_email_token, user_email_token_expires, user_registration, user_editcount, user_password_expires )
+SELECT user_id, user_name, user_real_name, user_password, user_newpassword, user_newpass_time, user_email, user_touched, user_token, user_email_authenticated, user_email_token, user_email_token_expires, user_registration, user_editcount, user_password_expires
+FROM /*_*/__temp__user;
+DROP TABLE /*_*/__temp__user;
+CREATE UNIQUE INDEX user_name ON /*_*/user (user_name);
+CREATE INDEX user_email_token ON /*_*/user (user_email_token);
+CREATE INDEX user_email ON /*_*/user (user_email); \ No newline at end of file
diff --git a/sql/sqlite/patch-user-user_is_temp.sql b/sql/sqlite/patch-user-user_is_temp.sql
new file mode 100644
index 000000000000..4831c362d38f
--- /dev/null
+++ b/sql/sqlite/patch-user-user_is_temp.sql
@@ -0,0 +1,6 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-user-user_is_temp.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+ALTER TABLE /*_*/user
+ADD COLUMN user_is_temp SMALLINT DEFAULT 0 NOT NULL; \ No newline at end of file
diff --git a/sql/sqlite/patch-user_autocreate_serial-uas_year.sql b/sql/sqlite/patch-user_autocreate_serial-uas_year.sql
new file mode 100644
index 000000000000..390a7dfd787b
--- /dev/null
+++ b/sql/sqlite/patch-user_autocreate_serial-uas_year.sql
@@ -0,0 +1,25 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-user_autocreate_serial-uas_year.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TEMPORARY TABLE /*_*/__temp__user_autocreate_serial AS
+SELECT
+ uas_shard,
+ uas_value
+FROM /*_*/user_autocreate_serial;
+DROP TABLE /*_*/user_autocreate_serial;
+
+
+CREATE TABLE /*_*/user_autocreate_serial (
+ uas_shard INTEGER UNSIGNED NOT NULL,
+ uas_year SMALLINT UNSIGNED NOT NULL,
+ uas_value INTEGER UNSIGNED NOT NULL,
+ PRIMARY KEY(uas_shard, uas_year)
+ );
+INSERT INTO /*_*/user_autocreate_serial (uas_shard, uas_value)
+SELECT
+ uas_shard,
+ uas_value
+FROM
+ /*_*/__temp__user_autocreate_serial;
+DROP TABLE /*_*/__temp__user_autocreate_serial;
diff --git a/sql/sqlite/patch-user_autocreate_serial.sql b/sql/sqlite/patch-user_autocreate_serial.sql
new file mode 100644
index 000000000000..79e7a6ac2221
--- /dev/null
+++ b/sql/sqlite/patch-user_autocreate_serial.sql
@@ -0,0 +1,5 @@
+CREATE TABLE /*_*/user_autocreate_serial (
+ uas_shard INTEGER UNSIGNED NOT NULL,
+ uas_value INTEGER UNSIGNED NOT NULL,
+ PRIMARY KEY(uas_shard)
+);
diff --git a/sql/sqlite/patch-user_properties-rename-index.sql b/sql/sqlite/patch-user_properties-rename-index.sql
new file mode 100644
index 000000000000..11ff1b737025
--- /dev/null
+++ b/sql/sqlite/patch-user_properties-rename-index.sql
@@ -0,0 +1,15 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-user_properties-rename-index.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX user_properties_property;
+CREATE TEMPORARY TABLE /*_*/__temp__user_properties AS
+SELECT up_user, up_property, up_value
+FROM /*_*/user_properties;
+DROP TABLE /*_*/user_properties;
+CREATE TABLE /*_*/user_properties ( up_user INTEGER UNSIGNED NOT NULL, up_property BLOB NOT NULL, up_value BLOB DEFAULT NULL, PRIMARY KEY(up_user, up_property) );
+INSERT INTO /*_*/user_properties (up_user, up_property, up_value)
+SELECT up_user, up_property, up_value
+FROM /*_*/__temp__user_properties;
+DROP TABLE /*_*/__temp__user_properties;
+CREATE INDEX up_property ON /*_*/user_properties (up_property); \ No newline at end of file
diff --git a/sql/sqlite/patch-user_table-updates.sql b/sql/sqlite/patch-user_table-updates.sql
new file mode 100644
index 000000000000..acaabbb08b74
--- /dev/null
+++ b/sql/sqlite/patch-user_table-updates.sql
@@ -0,0 +1,19 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-user_table-updates.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX user_name;
+DROP INDEX user_email_token;
+DROP INDEX user_email;
+CREATE TEMPORARY TABLE /*_*/__temp__user AS
+SELECT user_id, user_name, user_real_name, user_password, user_newpassword, user_newpass_time, user_email, user_touched, user_token, user_email_authenticated, user_email_token, user_email_token_expires, user_registration, user_editcount, user_password_expires
+FROM /*_*/user;
+DROP TABLE /*_*/user;
+CREATE TABLE /*_*/user ( user_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_password BLOB NOT NULL, user_newpassword BLOB NOT NULL, user_newpass_time BLOB DEFAULT NULL, user_email CLOB NOT NULL, user_token BLOB DEFAULT '' NOT NULL, user_email_authenticated BLOB DEFAULT NULL, user_email_token BLOB DEFAULT NULL, user_email_token_expires BLOB DEFAULT NULL, user_registration BLOB DEFAULT NULL, user_editcount INTEGER DEFAULT NULL, user_password_expires BLOB DEFAULT NULL, user_name BLOB DEFAULT '' NOT NULL, user_real_name BLOB DEFAULT '' NOT NULL, user_touched BLOB NOT NULL );
+INSERT INTO /*_*/user ( user_id, user_name, user_real_name, user_password, user_newpassword, user_newpass_time, user_email, user_touched, user_token, user_email_authenticated, user_email_token, user_email_token_expires, user_registration, user_editcount, user_password_expires )
+SELECT user_id, user_name, user_real_name, user_password, user_newpassword, user_newpass_time, user_email, user_touched, user_token, user_email_authenticated, user_email_token, user_email_token_expires, user_registration, user_editcount, user_password_expires
+FROM /*_*/__temp__user;
+DROP TABLE /*_*/__temp__user;
+CREATE UNIQUE INDEX user_name ON /*_*/user (user_name);
+CREATE INDEX user_email_token ON /*_*/user (user_email_token);
+CREATE INDEX user_email ON /*_*/user (user_email); \ No newline at end of file
diff --git a/sql/sqlite/patch-watchlist-namespace_title-rename-index.sql b/sql/sqlite/patch-watchlist-namespace_title-rename-index.sql
new file mode 100644
index 000000000000..ad89c87b3ecd
--- /dev/null
+++ b/sql/sqlite/patch-watchlist-namespace_title-rename-index.sql
@@ -0,0 +1,19 @@
+-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
+-- Source: maintenance/abstractSchemaChanges/patch-watchlist-namespace_title-rename-index.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+DROP INDEX wl_user;
+DROP INDEX namespace_title;
+DROP INDEX wl_user_notificationtimestamp;
+CREATE TEMPORARY TABLE /*_*/__temp__watchlist AS
+SELECT wl_id, wl_user, wl_namespace, wl_title, wl_notificationtimestamp
+FROM /*_*/watchlist;
+DROP TABLE /*_*/watchlist;
+CREATE TABLE /*_*/watchlist ( wl_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, wl_user INTEGER UNSIGNED NOT NULL, wl_namespace INTEGER DEFAULT 0 NOT NULL, wl_title BLOB DEFAULT '' NOT NULL, wl_notificationtimestamp BLOB DEFAULT NULL );
+INSERT INTO /*_*/watchlist ( wl_id, wl_user, wl_namespace, wl_title, wl_notificationtimestamp )
+SELECT wl_id, wl_user, wl_namespace, wl_title, wl_notificationtimestamp
+FROM /*_*/__temp__watchlist;
+DROP TABLE /*_*/__temp__watchlist;
+CREATE UNIQUE INDEX wl_user ON /*_*/watchlist (wl_user, wl_namespace, wl_title);
+CREATE INDEX wl_user_notificationtimestamp ON /*_*/watchlist ( wl_user, wl_notificationtimestamp );
+CREATE INDEX wl_namespace_title ON /*_*/watchlist (wl_namespace, wl_title); \ No newline at end of file
diff --git a/sql/sqlite/patch-watchlist-wl_title-varbinary.sql b/sql/sqlite/patch-watchlist-wl_title-varbinary.sql
new file mode 100644
index 000000000000..f0c681696658
--- /dev/null
+++ b/sql/sqlite/patch-watchlist-wl_title-varbinary.sql
@@ -0,0 +1,21 @@
+CREATE TABLE /*_*/watchlist_tmp (
+ wl_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ wl_user INTEGER UNSIGNED NOT NULL,
+ wl_namespace INTEGER DEFAULT 0 NOT NULL,
+ wl_title BLOB DEFAULT '' NOT NULL,
+ wl_notificationtimestamp BLOB DEFAULT NULL
+);
+
+INSERT INTO /*_*/watchlist_tmp
+ SELECT wl_id, wl_user, wl_namespace, wl_title, wl_notificationtimestamp
+ FROM /*_*/watchlist;
+DROP TABLE /*_*/watchlist;
+ALTER TABLE /*_*/watchlist_tmp RENAME TO /*_*/watchlist;
+
+CREATE UNIQUE INDEX wl_user ON /*_*/watchlist (wl_user, wl_namespace, wl_title);
+
+CREATE INDEX namespace_title ON /*_*/watchlist (wl_namespace, wl_title);
+
+CREATE INDEX wl_user_notificationtimestamp ON /*_*/watchlist (
+ wl_user, wl_notificationtimestamp
+); \ No newline at end of file
diff --git a/sql/sqlite/searchindex-fts3.sql b/sql/sqlite/searchindex-fts3.sql
new file mode 100644
index 000000000000..38cdfcfc76c8
--- /dev/null
+++ b/sql/sqlite/searchindex-fts3.sql
@@ -0,0 +1,18 @@
+-- Patch that introduces fulltext search capabilities to SQLite schema
+-- Requires that SQLite must be compiled with FTS3 module (comes with core amalgamation).
+-- See https://sqlite.org/fts3.html for details of syntax.
+-- Will fail if FTS3 is not present,
+DROP TABLE IF EXISTS /*_*/searchindex;
+CREATE VIRTUAL TABLE /*_*/searchindex USING FTS3(
+ -- Key to page_id
+ -- Disabled, instead we use the built-in rowid column
+ -- si_page INTEGER NOT NULL,
+
+ -- Munged version of title
+ si_title,
+
+ -- Munged version of body text
+ si_text
+);
+
+INSERT INTO /*_*/updatelog (ul_key) VALUES ('fts3');
diff --git a/sql/sqlite/searchindex-no-fts.sql b/sql/sqlite/searchindex-no-fts.sql
new file mode 100644
index 000000000000..4497d55c4d02
--- /dev/null
+++ b/sql/sqlite/searchindex-no-fts.sql
@@ -0,0 +1,23 @@
+-- Searchindex table definition for cases when no full-text search SQLite module is present
+-- (currently, only FTS3 is supported).
+-- Use it if you are moving your database from environment with FTS support
+-- to environment without it.
+
+DROP TABLE IF EXISTS /*_*/searchindex;
+
+-- These are pieces of FTS3-enabled searchindex
+DROP TABLE IF EXISTS /*_*/searchindex_content;
+DROP TABLE IF EXISTS /*_*/searchindex_segdir;
+DROP TABLE IF EXISTS /*_*/searchindex_segments;
+
+CREATE TABLE /*_*/searchindex (
+ si_page INTEGER UNSIGNED NOT NULL,
+ si_title CLOB NOT NULL,
+ si_text CLOB NOT NULL,
+ PRIMARY KEY(si_page)
+);
+
+CREATE INDEX si_title ON /*_*/searchindex (si_title);
+CREATE INDEX si_text ON /*_*/searchindex (si_text);
+
+DELETE FROM /*_*/updatelog WHERE ul_key='fts3';
diff --git a/sql/sqlite/tables-generated.sql b/sql/sqlite/tables-generated.sql
new file mode 100644
index 000000000000..cd1a747afb9c
--- /dev/null
+++ b/sql/sqlite/tables-generated.sql
@@ -0,0 +1,871 @@
+-- This file is automatically generated using maintenance/generateSchemaSql.php.
+-- Source: sql/tables.json
+-- Do not modify this file directly.
+-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
+CREATE TABLE /*_*/site_identifiers (
+ si_type BLOB NOT NULL,
+ si_key BLOB NOT NULL,
+ si_site INTEGER UNSIGNED NOT NULL,
+ PRIMARY KEY(si_type, si_key)
+);
+
+CREATE INDEX si_site ON /*_*/site_identifiers (si_site);
+
+CREATE INDEX si_key ON /*_*/site_identifiers (si_key);
+
+
+CREATE TABLE /*_*/updatelog (
+ ul_key VARCHAR(255) NOT NULL,
+ ul_value BLOB DEFAULT NULL,
+ PRIMARY KEY(ul_key)
+);
+
+
+CREATE TABLE /*_*/actor (
+ actor_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ actor_user INTEGER UNSIGNED DEFAULT NULL,
+ actor_name BLOB NOT NULL
+);
+
+CREATE UNIQUE INDEX actor_user ON /*_*/actor (actor_user);
+
+CREATE UNIQUE INDEX actor_name ON /*_*/actor (actor_name);
+
+
+CREATE TABLE /*_*/user_former_groups (
+ ufg_user INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ ufg_group BLOB DEFAULT '' NOT NULL,
+ PRIMARY KEY(ufg_user, ufg_group)
+);
+
+
+CREATE TABLE /*_*/bot_passwords (
+ bp_user INTEGER UNSIGNED NOT NULL,
+ bp_app_id BLOB NOT NULL,
+ bp_password BLOB NOT NULL,
+ bp_token BLOB DEFAULT '' NOT NULL,
+ bp_restrictions BLOB NOT NULL,
+ bp_grants BLOB NOT NULL,
+ PRIMARY KEY(bp_user, bp_app_id)
+);
+
+
+CREATE TABLE /*_*/comment (
+ comment_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ comment_hash INTEGER NOT NULL, comment_text BLOB NOT NULL,
+ comment_data BLOB DEFAULT NULL
+);
+
+CREATE INDEX comment_hash ON /*_*/comment (comment_hash);
+
+
+CREATE TABLE /*_*/slots (
+ slot_revision_id BIGINT UNSIGNED NOT NULL,
+ slot_role_id SMALLINT UNSIGNED NOT NULL,
+ slot_content_id BIGINT UNSIGNED NOT NULL,
+ slot_origin BIGINT UNSIGNED NOT NULL,
+ PRIMARY KEY(slot_revision_id, slot_role_id)
+);
+
+CREATE INDEX slot_revision_origin_role ON /*_*/slots (
+ slot_revision_id, slot_origin, slot_role_id
+);
+
+
+CREATE TABLE /*_*/site_stats (
+ ss_row_id INTEGER UNSIGNED NOT NULL,
+ ss_total_edits BIGINT UNSIGNED DEFAULT NULL,
+ ss_good_articles BIGINT UNSIGNED DEFAULT NULL,
+ ss_total_pages BIGINT UNSIGNED DEFAULT NULL,
+ ss_users BIGINT UNSIGNED DEFAULT NULL,
+ ss_active_users BIGINT UNSIGNED DEFAULT NULL,
+ ss_images BIGINT UNSIGNED DEFAULT NULL,
+ PRIMARY KEY(ss_row_id)
+);
+
+
+CREATE TABLE /*_*/user_properties (
+ up_user INTEGER UNSIGNED NOT NULL,
+ up_property BLOB NOT NULL,
+ up_value BLOB DEFAULT NULL,
+ PRIMARY KEY(up_user, up_property)
+);
+
+CREATE INDEX up_property ON /*_*/user_properties (up_property);
+
+
+CREATE TABLE /*_*/log_search (
+ ls_field BLOB NOT NULL,
+ ls_value VARCHAR(255) NOT NULL,
+ ls_log_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ PRIMARY KEY(ls_field, ls_value, ls_log_id)
+);
+
+CREATE INDEX ls_log_id ON /*_*/log_search (ls_log_id);
+
+
+CREATE TABLE /*_*/change_tag (
+ ct_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ ct_rc_id BIGINT UNSIGNED DEFAULT NULL,
+ ct_log_id INTEGER UNSIGNED DEFAULT NULL,
+ ct_rev_id INTEGER UNSIGNED DEFAULT NULL,
+ ct_params BLOB DEFAULT NULL, ct_tag_id INTEGER UNSIGNED NOT NULL
+);
+
+CREATE UNIQUE INDEX ct_rc_tag_id ON /*_*/change_tag (ct_rc_id, ct_tag_id);
+
+CREATE UNIQUE INDEX ct_log_tag_id ON /*_*/change_tag (ct_log_id, ct_tag_id);
+
+CREATE UNIQUE INDEX ct_rev_tag_id ON /*_*/change_tag (ct_rev_id, ct_tag_id);
+
+CREATE INDEX ct_tag_id_id ON /*_*/change_tag (
+ ct_tag_id, ct_rc_id, ct_rev_id, ct_log_id
+);
+
+
+CREATE TABLE /*_*/content (
+ content_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ content_size INTEGER UNSIGNED NOT NULL,
+ content_sha1 BLOB NOT NULL, content_model SMALLINT UNSIGNED NOT NULL,
+ content_address BLOB NOT NULL
+);
+
+
+CREATE TABLE /*_*/l10n_cache (
+ lc_lang BLOB NOT NULL,
+ lc_key VARCHAR(255) NOT NULL,
+ lc_value BLOB NOT NULL,
+ PRIMARY KEY(lc_lang, lc_key)
+);
+
+
+CREATE TABLE /*_*/module_deps (
+ md_module BLOB NOT NULL,
+ md_skin BLOB NOT NULL,
+ md_deps BLOB NOT NULL,
+ PRIMARY KEY(md_module, md_skin)
+);
+
+
+CREATE TABLE /*_*/redirect (
+ rd_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ rd_namespace INTEGER DEFAULT 0 NOT NULL,
+ rd_title BLOB DEFAULT '' NOT NULL,
+ rd_interwiki VARCHAR(32) DEFAULT NULL,
+ rd_fragment BLOB DEFAULT NULL,
+ PRIMARY KEY(rd_from)
+);
+
+CREATE INDEX rd_ns_title ON /*_*/redirect (rd_namespace, rd_title, rd_from);
+
+
+CREATE TABLE /*_*/pagelinks (
+ pl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ pl_target_id BIGINT UNSIGNED NOT NULL,
+ pl_from_namespace INTEGER DEFAULT 0 NOT NULL,
+ PRIMARY KEY(pl_from, pl_target_id)
+);
+
+CREATE INDEX pl_target_id ON /*_*/pagelinks (pl_target_id, pl_from);
+
+CREATE INDEX pl_backlinks_namespace_target_id ON /*_*/pagelinks (
+ pl_from_namespace, pl_target_id,
+ pl_from
+);
+
+
+CREATE TABLE /*_*/templatelinks (
+ tl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ tl_target_id BIGINT UNSIGNED NOT NULL,
+ tl_from_namespace INTEGER DEFAULT 0 NOT NULL,
+ PRIMARY KEY(tl_from, tl_target_id)
+);
+
+CREATE INDEX tl_target_id ON /*_*/templatelinks (tl_target_id, tl_from);
+
+CREATE INDEX tl_backlinks_namespace_target_id ON /*_*/templatelinks (
+ tl_from_namespace, tl_target_id,
+ tl_from
+);
+
+
+CREATE TABLE /*_*/imagelinks (
+ il_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ il_to BLOB DEFAULT '' NOT NULL,
+ il_from_namespace INTEGER DEFAULT 0 NOT NULL,
+ PRIMARY KEY(il_from, il_to)
+);
+
+CREATE INDEX il_to ON /*_*/imagelinks (il_to, il_from);
+
+CREATE INDEX il_backlinks_namespace ON /*_*/imagelinks (
+ il_from_namespace, il_to, il_from
+);
+
+
+CREATE TABLE /*_*/langlinks (
+ ll_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ ll_lang BLOB DEFAULT '' NOT NULL,
+ ll_title BLOB DEFAULT '' NOT NULL,
+ PRIMARY KEY(ll_from, ll_lang)
+);
+
+CREATE INDEX ll_lang ON /*_*/langlinks (ll_lang, ll_title);
+
+
+CREATE TABLE /*_*/iwlinks (
+ iwl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ iwl_prefix BLOB DEFAULT '' NOT NULL,
+ iwl_title BLOB DEFAULT '' NOT NULL,
+ PRIMARY KEY(iwl_from, iwl_prefix, iwl_title)
+);
+
+CREATE INDEX iwl_prefix_title_from ON /*_*/iwlinks (iwl_prefix, iwl_title, iwl_from);
+
+
+CREATE TABLE /*_*/category (
+ cat_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ cat_title BLOB NOT NULL, cat_pages INTEGER DEFAULT 0 NOT NULL,
+ cat_subcats INTEGER DEFAULT 0 NOT NULL,
+ cat_files INTEGER DEFAULT 0 NOT NULL
+);
+
+CREATE UNIQUE INDEX cat_title ON /*_*/category (cat_title);
+
+CREATE INDEX cat_pages ON /*_*/category (cat_pages);
+
+
+CREATE TABLE /*_*/watchlist_expiry (
+ we_item INTEGER UNSIGNED NOT NULL,
+ we_expiry BLOB NOT NULL,
+ PRIMARY KEY(we_item)
+);
+
+CREATE INDEX we_expiry ON /*_*/watchlist_expiry (we_expiry);
+
+
+CREATE TABLE /*_*/change_tag_def (
+ ctd_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ ctd_name BLOB NOT NULL, ctd_user_defined SMALLINT NOT NULL,
+ ctd_count BIGINT UNSIGNED DEFAULT 0 NOT NULL
+);
+
+CREATE UNIQUE INDEX ctd_name ON /*_*/change_tag_def (ctd_name);
+
+CREATE INDEX ctd_count ON /*_*/change_tag_def (ctd_count);
+
+CREATE INDEX ctd_user_defined ON /*_*/change_tag_def (ctd_user_defined);
+
+
+CREATE TABLE /*_*/ipblocks_restrictions (
+ ir_ipb_id INTEGER UNSIGNED NOT NULL,
+ ir_type SMALLINT NOT NULL,
+ ir_value INTEGER UNSIGNED NOT NULL,
+ PRIMARY KEY(ir_ipb_id, ir_type, ir_value)
+);
+
+CREATE INDEX ir_type_value ON /*_*/ipblocks_restrictions (ir_type, ir_value);
+
+
+CREATE TABLE /*_*/querycache (
+ qc_type BLOB NOT NULL, qc_value INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ qc_namespace INTEGER DEFAULT 0 NOT NULL,
+ qc_title BLOB DEFAULT '' NOT NULL
+);
+
+CREATE INDEX qc_type ON /*_*/querycache (qc_type, qc_value);
+
+
+CREATE TABLE /*_*/querycachetwo (
+ qcc_type BLOB NOT NULL, qcc_value INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ qcc_namespace INTEGER DEFAULT 0 NOT NULL,
+ qcc_title BLOB DEFAULT '' NOT NULL,
+ qcc_namespacetwo INTEGER DEFAULT 0 NOT NULL,
+ qcc_titletwo BLOB DEFAULT '' NOT NULL
+);
+
+CREATE INDEX qcc_type ON /*_*/querycachetwo (qcc_type, qcc_value);
+
+CREATE INDEX qcc_title ON /*_*/querycachetwo (
+ qcc_type, qcc_namespace, qcc_title
+);
+
+CREATE INDEX qcc_titletwo ON /*_*/querycachetwo (
+ qcc_type, qcc_namespacetwo, qcc_titletwo
+);
+
+
+CREATE TABLE /*_*/page_restrictions (
+ pr_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ pr_page INTEGER UNSIGNED NOT NULL,
+ pr_type BLOB NOT NULL, pr_level BLOB NOT NULL,
+ pr_cascade SMALLINT NOT NULL, pr_expiry BLOB DEFAULT NULL
+);
+
+CREATE UNIQUE INDEX pr_pagetype ON /*_*/page_restrictions (pr_page, pr_type);
+
+CREATE INDEX pr_typelevel ON /*_*/page_restrictions (pr_type, pr_level);
+
+CREATE INDEX pr_level ON /*_*/page_restrictions (pr_level);
+
+CREATE INDEX pr_cascade ON /*_*/page_restrictions (pr_cascade);
+
+
+CREATE TABLE /*_*/user_groups (
+ ug_user INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ ug_group BLOB DEFAULT '' NOT NULL,
+ ug_expiry BLOB DEFAULT NULL,
+ PRIMARY KEY(ug_user, ug_group)
+);
+
+CREATE INDEX ug_group ON /*_*/user_groups (ug_group);
+
+CREATE INDEX ug_expiry ON /*_*/user_groups (ug_expiry);
+
+
+CREATE TABLE /*_*/querycache_info (
+ qci_type BLOB DEFAULT '' NOT NULL,
+ qci_timestamp BLOB DEFAULT '19700101000000' NOT NULL,
+ PRIMARY KEY(qci_type)
+);
+
+
+CREATE TABLE /*_*/watchlist (
+ wl_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ wl_user INTEGER UNSIGNED NOT NULL,
+ wl_namespace INTEGER DEFAULT 0 NOT NULL,
+ wl_title BLOB DEFAULT '' NOT NULL, wl_notificationtimestamp BLOB DEFAULT NULL
+);
+
+CREATE UNIQUE INDEX wl_user ON /*_*/watchlist (wl_user, wl_namespace, wl_title);
+
+CREATE INDEX wl_namespace_title ON /*_*/watchlist (wl_namespace, wl_title);
+
+CREATE INDEX wl_user_notificationtimestamp ON /*_*/watchlist (
+ wl_user, wl_notificationtimestamp
+);
+
+
+CREATE TABLE /*_*/sites (
+ site_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ site_global_key BLOB NOT NULL,
+ site_type BLOB NOT NULL,
+ site_group BLOB NOT NULL,
+ site_source BLOB NOT NULL,
+ site_language BLOB NOT NULL,
+ site_protocol BLOB NOT NULL,
+ site_domain VARCHAR(255) NOT NULL,
+ site_data BLOB NOT NULL,
+ site_forward SMALLINT NOT NULL,
+ site_config BLOB NOT NULL
+);
+
+CREATE UNIQUE INDEX site_global_key ON /*_*/sites (site_global_key);
+
+
+CREATE TABLE /*_*/user_newtalk (
+ user_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ user_ip BLOB DEFAULT '' NOT NULL, user_last_timestamp BLOB DEFAULT NULL
+);
+
+CREATE INDEX un_user_id ON /*_*/user_newtalk (user_id);
+
+CREATE INDEX un_user_ip ON /*_*/user_newtalk (user_ip);
+
+
+CREATE TABLE /*_*/interwiki (
+ iw_prefix VARCHAR(32) NOT NULL,
+ iw_url BLOB NOT NULL,
+ iw_api BLOB NOT NULL,
+ iw_wikiid VARCHAR(64) NOT NULL,
+ iw_local SMALLINT NOT NULL,
+ iw_trans SMALLINT DEFAULT 0 NOT NULL,
+ PRIMARY KEY(iw_prefix)
+);
+
+
+CREATE TABLE /*_*/protected_titles (
+ pt_namespace INTEGER NOT NULL,
+ pt_title BLOB NOT NULL,
+ pt_user INTEGER UNSIGNED NOT NULL,
+ pt_reason_id BIGINT UNSIGNED NOT NULL,
+ pt_timestamp BLOB NOT NULL,
+ pt_expiry BLOB NOT NULL,
+ pt_create_perm BLOB NOT NULL,
+ PRIMARY KEY(pt_namespace, pt_title)
+);
+
+CREATE INDEX pt_timestamp ON /*_*/protected_titles (pt_timestamp);
+
+
+CREATE TABLE /*_*/externallinks (
+ el_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ el_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ el_to_domain_index BLOB DEFAULT '' NOT NULL,
+ el_to_path BLOB DEFAULT NULL
+);
+
+CREATE INDEX el_from ON /*_*/externallinks (el_from);
+
+CREATE INDEX el_to_domain_index_to_path ON /*_*/externallinks (el_to_domain_index, el_to_path);
+
+
+CREATE TABLE /*_*/ip_changes (
+ ipc_rev_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ ipc_rev_timestamp BLOB NOT NULL,
+ ipc_hex BLOB DEFAULT '' NOT NULL,
+ PRIMARY KEY(ipc_rev_id)
+);
+
+CREATE INDEX ipc_rev_timestamp ON /*_*/ip_changes (ipc_rev_timestamp);
+
+CREATE INDEX ipc_hex_time ON /*_*/ip_changes (ipc_hex, ipc_rev_timestamp);
+
+
+CREATE TABLE /*_*/page_props (
+ pp_page INTEGER UNSIGNED NOT NULL,
+ pp_propname BLOB NOT NULL,
+ pp_value BLOB NOT NULL,
+ pp_sortkey DOUBLE PRECISION DEFAULT NULL,
+ PRIMARY KEY(pp_page, pp_propname)
+);
+
+CREATE UNIQUE INDEX pp_propname_page ON /*_*/page_props (pp_propname, pp_page);
+
+CREATE UNIQUE INDEX pp_propname_sortkey_page ON /*_*/page_props (pp_propname, pp_sortkey, pp_page);
+
+
+CREATE TABLE /*_*/job (
+ job_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ job_cmd BLOB DEFAULT '' NOT NULL, job_namespace INTEGER NOT NULL,
+ job_title BLOB NOT NULL, job_timestamp BLOB DEFAULT NULL,
+ job_params BLOB NOT NULL, job_random INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ job_attempts INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ job_token BLOB DEFAULT '' NOT NULL,
+ job_token_timestamp BLOB DEFAULT NULL,
+ job_sha1 BLOB DEFAULT '' NOT NULL
+);
+
+CREATE INDEX job_sha1 ON /*_*/job (job_sha1);
+
+CREATE INDEX job_cmd_token ON /*_*/job (job_cmd, job_token, job_random);
+
+CREATE INDEX job_cmd_token_id ON /*_*/job (job_cmd, job_token, job_id);
+
+CREATE INDEX job_cmd ON /*_*/job (
+ job_cmd, job_namespace, job_title,
+ job_params
+);
+
+CREATE INDEX job_timestamp ON /*_*/job (job_timestamp);
+
+
+CREATE TABLE /*_*/slot_roles (
+ role_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ role_name BLOB NOT NULL
+);
+
+CREATE UNIQUE INDEX role_name ON /*_*/slot_roles (role_name);
+
+
+CREATE TABLE /*_*/content_models (
+ model_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ model_name BLOB NOT NULL
+);
+
+CREATE UNIQUE INDEX model_name ON /*_*/content_models (model_name);
+
+
+CREATE TABLE /*_*/categorylinks (
+ cl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ cl_to BLOB DEFAULT '' NOT NULL,
+ cl_sortkey BLOB DEFAULT '' NOT NULL,
+ cl_sortkey_prefix BLOB DEFAULT '' NOT NULL,
+ cl_timestamp DATETIME NOT NULL,
+ cl_collation BLOB DEFAULT '' NOT NULL,
+ cl_type TEXT DEFAULT 'page' NOT NULL,
+ PRIMARY KEY(cl_from, cl_to)
+);
+
+CREATE INDEX cl_sortkey ON /*_*/categorylinks (
+ cl_to, cl_type, cl_sortkey, cl_from
+);
+
+CREATE INDEX cl_timestamp ON /*_*/categorylinks (cl_to, cl_timestamp);
+
+
+CREATE TABLE /*_*/logging (
+ log_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ log_type BLOB DEFAULT '' NOT NULL, log_action BLOB DEFAULT '' NOT NULL,
+ log_timestamp BLOB DEFAULT '19700101000000' NOT NULL,
+ log_actor BIGINT UNSIGNED NOT NULL,
+ log_namespace INTEGER DEFAULT 0 NOT NULL,
+ log_title BLOB DEFAULT '' NOT NULL,
+ log_page INTEGER UNSIGNED DEFAULT NULL,
+ log_comment_id BIGINT UNSIGNED NOT NULL,
+ log_params BLOB NOT NULL, log_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL
+);
+
+CREATE INDEX log_type_time ON /*_*/logging (log_type, log_timestamp);
+
+CREATE INDEX log_actor_time ON /*_*/logging (log_actor, log_timestamp);
+
+CREATE INDEX log_page_time ON /*_*/logging (
+ log_namespace, log_title, log_timestamp
+);
+
+CREATE INDEX log_times ON /*_*/logging (log_timestamp);
+
+CREATE INDEX log_actor_type_time ON /*_*/logging (
+ log_actor, log_type, log_timestamp
+);
+
+CREATE INDEX log_page_id_time ON /*_*/logging (log_page, log_timestamp);
+
+CREATE INDEX log_type_action ON /*_*/logging (
+ log_type, log_action, log_timestamp
+);
+
+
+CREATE TABLE /*_*/uploadstash (
+ us_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ us_user INTEGER UNSIGNED NOT NULL,
+ us_key VARCHAR(255) NOT NULL,
+ us_orig_path VARCHAR(255) NOT NULL,
+ us_path VARCHAR(255) NOT NULL,
+ us_source_type VARCHAR(50) DEFAULT NULL,
+ us_timestamp BLOB NOT NULL,
+ us_status VARCHAR(50) NOT NULL,
+ us_chunk_inx INTEGER UNSIGNED DEFAULT NULL,
+ us_props BLOB DEFAULT NULL,
+ us_size BIGINT UNSIGNED NOT NULL,
+ us_sha1 VARCHAR(31) NOT NULL,
+ us_mime VARCHAR(255) DEFAULT NULL,
+ us_media_type TEXT DEFAULT NULL,
+ us_image_width INTEGER UNSIGNED DEFAULT NULL,
+ us_image_height INTEGER UNSIGNED DEFAULT NULL,
+ us_image_bits SMALLINT UNSIGNED DEFAULT NULL
+);
+
+CREATE INDEX us_user ON /*_*/uploadstash (us_user);
+
+CREATE UNIQUE INDEX us_key ON /*_*/uploadstash (us_key);
+
+CREATE INDEX us_timestamp ON /*_*/uploadstash (us_timestamp);
+
+
+CREATE TABLE /*_*/filearchive (
+ fa_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ fa_name BLOB DEFAULT '' NOT NULL, fa_archive_name BLOB DEFAULT '',
+ fa_storage_group BLOB DEFAULT NULL,
+ fa_storage_key BLOB DEFAULT '', fa_deleted_user INTEGER DEFAULT NULL,
+ fa_deleted_timestamp BLOB DEFAULT NULL,
+ fa_deleted_reason_id BIGINT UNSIGNED NOT NULL,
+ fa_size BIGINT UNSIGNED DEFAULT 0,
+ fa_width INTEGER DEFAULT 0, fa_height INTEGER DEFAULT 0,
+ fa_metadata BLOB DEFAULT NULL, fa_bits INTEGER DEFAULT 0,
+ fa_media_type TEXT DEFAULT NULL, fa_major_mime TEXT DEFAULT 'unknown',
+ fa_minor_mime BLOB DEFAULT 'unknown',
+ fa_description_id BIGINT UNSIGNED NOT NULL,
+ fa_actor BIGINT UNSIGNED NOT NULL,
+ fa_timestamp BLOB DEFAULT NULL, fa_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ fa_sha1 BLOB DEFAULT '' NOT NULL
+);
+
+CREATE INDEX fa_name ON /*_*/filearchive (fa_name, fa_timestamp);
+
+CREATE INDEX fa_storage_group ON /*_*/filearchive (
+ fa_storage_group, fa_storage_key
+);
+
+CREATE INDEX fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp);
+
+CREATE INDEX fa_actor_timestamp ON /*_*/filearchive (fa_actor, fa_timestamp);
+
+CREATE INDEX fa_sha1 ON /*_*/filearchive (fa_sha1);
+
+
+CREATE TABLE /*_*/text (
+ old_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ old_text BLOB NOT NULL, old_flags BLOB NOT NULL
+);
+
+
+CREATE TABLE /*_*/oldimage (
+ oi_name BLOB DEFAULT '' NOT NULL, oi_archive_name BLOB DEFAULT '' NOT NULL,
+ oi_size BIGINT UNSIGNED DEFAULT 0 NOT NULL,
+ oi_width INTEGER DEFAULT 0 NOT NULL,
+ oi_height INTEGER DEFAULT 0 NOT NULL,
+ oi_bits INTEGER DEFAULT 0 NOT NULL,
+ oi_description_id BIGINT UNSIGNED NOT NULL,
+ oi_actor BIGINT UNSIGNED NOT NULL,
+ oi_timestamp BLOB NOT NULL, oi_metadata BLOB NOT NULL,
+ oi_media_type TEXT DEFAULT NULL, oi_major_mime TEXT DEFAULT 'unknown' NOT NULL,
+ oi_minor_mime BLOB DEFAULT 'unknown' NOT NULL,
+ oi_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ oi_sha1 BLOB DEFAULT '' NOT NULL
+);
+
+CREATE INDEX oi_actor_timestamp ON /*_*/oldimage (oi_actor, oi_timestamp);
+
+CREATE INDEX oi_name_timestamp ON /*_*/oldimage (oi_name, oi_timestamp);
+
+CREATE INDEX oi_name_archive_name ON /*_*/oldimage (oi_name, oi_archive_name);
+
+CREATE INDEX oi_sha1 ON /*_*/oldimage (oi_sha1);
+
+CREATE INDEX oi_timestamp ON /*_*/oldimage (oi_timestamp);
+
+
+CREATE TABLE /*_*/objectcache (
+ keyname BLOB DEFAULT '' NOT NULL,
+ value BLOB DEFAULT NULL,
+ exptime BLOB NOT NULL,
+ modtoken VARCHAR(17) DEFAULT '00000000000000000' NOT NULL,
+ flags INTEGER UNSIGNED DEFAULT NULL,
+ PRIMARY KEY(keyname)
+);
+
+CREATE INDEX exptime ON /*_*/objectcache (exptime);
+
+
+CREATE TABLE /*_*/block (
+ bl_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ bl_target INTEGER UNSIGNED NOT NULL,
+ bl_by_actor BIGINT UNSIGNED NOT NULL,
+ bl_reason_id BIGINT UNSIGNED NOT NULL,
+ bl_timestamp BLOB NOT NULL, bl_anon_only SMALLINT DEFAULT 0 NOT NULL,
+ bl_create_account SMALLINT DEFAULT 1 NOT NULL,
+ bl_enable_autoblock SMALLINT DEFAULT 1 NOT NULL,
+ bl_expiry BLOB NOT NULL, bl_deleted SMALLINT DEFAULT 0 NOT NULL,
+ bl_block_email SMALLINT DEFAULT 0 NOT NULL,
+ bl_allow_usertalk SMALLINT DEFAULT 0 NOT NULL,
+ bl_parent_block_id INTEGER UNSIGNED DEFAULT NULL,
+ bl_sitewide SMALLINT DEFAULT 1 NOT NULL
+);
+
+CREATE INDEX bl_timestamp ON /*_*/block (bl_timestamp);
+
+CREATE INDEX bl_target ON /*_*/block (bl_target);
+
+CREATE INDEX bl_expiry ON /*_*/block (bl_expiry);
+
+CREATE INDEX bl_parent_block_id ON /*_*/block (bl_parent_block_id);
+
+
+CREATE TABLE /*_*/block_target (
+ bt_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ bt_address BLOB DEFAULT NULL, bt_user INTEGER UNSIGNED DEFAULT NULL,
+ bt_user_text BLOB DEFAULT NULL, bt_auto SMALLINT DEFAULT 0 NOT NULL,
+ bt_range_start BLOB DEFAULT NULL,
+ bt_range_end BLOB DEFAULT NULL, bt_ip_hex BLOB DEFAULT NULL,
+ bt_count INTEGER DEFAULT 0 NOT NULL
+);
+
+CREATE INDEX bt_address ON /*_*/block_target (bt_address);
+
+CREATE INDEX bt_ip_user_text ON /*_*/block_target (bt_ip_hex, bt_user_text);
+
+CREATE INDEX bt_range ON /*_*/block_target (bt_range_start, bt_range_end);
+
+CREATE INDEX bt_user ON /*_*/block_target (bt_user);
+
+
+CREATE TABLE /*_*/image (
+ img_name BLOB DEFAULT '' NOT NULL,
+ img_size BIGINT UNSIGNED DEFAULT 0 NOT NULL,
+ img_width INTEGER DEFAULT 0 NOT NULL,
+ img_height INTEGER DEFAULT 0 NOT NULL,
+ img_metadata BLOB NOT NULL,
+ img_bits INTEGER DEFAULT 0 NOT NULL,
+ img_media_type TEXT DEFAULT NULL,
+ img_major_mime TEXT DEFAULT 'unknown' NOT NULL,
+ img_minor_mime BLOB DEFAULT 'unknown' NOT NULL,
+ img_description_id BIGINT UNSIGNED NOT NULL,
+ img_actor BIGINT UNSIGNED NOT NULL,
+ img_timestamp BLOB NOT NULL,
+ img_sha1 BLOB DEFAULT '' NOT NULL,
+ PRIMARY KEY(img_name)
+);
+
+CREATE INDEX img_actor_timestamp ON /*_*/image (img_actor, img_timestamp);
+
+CREATE INDEX img_size ON /*_*/image (img_size);
+
+CREATE INDEX img_timestamp ON /*_*/image (img_timestamp);
+
+CREATE INDEX img_sha1 ON /*_*/image (img_sha1);
+
+CREATE INDEX img_media_mime ON /*_*/image (
+ img_media_type, img_major_mime, img_minor_mime
+);
+
+
+CREATE TABLE /*_*/recentchanges (
+ rc_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ rc_timestamp BLOB NOT NULL, rc_actor BIGINT UNSIGNED NOT NULL,
+ rc_namespace INTEGER DEFAULT 0 NOT NULL,
+ rc_title BLOB DEFAULT '' NOT NULL, rc_comment_id BIGINT UNSIGNED NOT NULL,
+ rc_minor SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rc_bot SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rc_new SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rc_cur_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ rc_this_oldid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ rc_last_oldid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ rc_type SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rc_source BLOB DEFAULT '' NOT NULL,
+ rc_patrolled SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rc_ip BLOB DEFAULT '' NOT NULL, rc_old_len INTEGER DEFAULT NULL,
+ rc_new_len INTEGER DEFAULT NULL, rc_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rc_logid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
+ rc_log_type BLOB DEFAULT NULL, rc_log_action BLOB DEFAULT NULL,
+ rc_params BLOB DEFAULT NULL
+);
+
+CREATE INDEX rc_timestamp ON /*_*/recentchanges (rc_timestamp);
+
+CREATE INDEX rc_namespace_title_timestamp ON /*_*/recentchanges (
+ rc_namespace, rc_title, rc_timestamp
+);
+
+CREATE INDEX rc_cur_id ON /*_*/recentchanges (rc_cur_id);
+
+CREATE INDEX rc_new_name_timestamp ON /*_*/recentchanges (
+ rc_new, rc_namespace, rc_timestamp
+);
+
+CREATE INDEX rc_ip ON /*_*/recentchanges (rc_ip);
+
+CREATE INDEX rc_ns_actor ON /*_*/recentchanges (rc_namespace, rc_actor);
+
+CREATE INDEX rc_actor ON /*_*/recentchanges (rc_actor, rc_timestamp);
+
+CREATE INDEX rc_name_type_patrolled_timestamp ON /*_*/recentchanges (
+ rc_namespace, rc_type, rc_patrolled,
+ rc_timestamp
+);
+
+CREATE INDEX rc_this_oldid ON /*_*/recentchanges (rc_this_oldid);
+
+
+CREATE TABLE /*_*/archive (
+ ar_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ ar_namespace INTEGER DEFAULT 0 NOT NULL,
+ ar_title BLOB DEFAULT '' NOT NULL, ar_comment_id BIGINT UNSIGNED NOT NULL,
+ ar_actor BIGINT UNSIGNED NOT NULL,
+ ar_timestamp BLOB NOT NULL, ar_minor_edit SMALLINT DEFAULT 0 NOT NULL,
+ ar_rev_id INTEGER UNSIGNED NOT NULL,
+ ar_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ ar_len INTEGER UNSIGNED DEFAULT NULL,
+ ar_page_id INTEGER UNSIGNED DEFAULT NULL,
+ ar_parent_id INTEGER UNSIGNED DEFAULT NULL,
+ ar_sha1 BLOB DEFAULT '' NOT NULL
+);
+
+CREATE INDEX ar_name_title_timestamp ON /*_*/archive (
+ ar_namespace, ar_title, ar_timestamp
+);
+
+CREATE INDEX ar_actor_timestamp ON /*_*/archive (ar_actor, ar_timestamp);
+
+CREATE UNIQUE INDEX ar_revid_uniq ON /*_*/archive (ar_rev_id);
+
+
+CREATE TABLE /*_*/page (
+ page_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ page_namespace INTEGER NOT NULL, page_title BLOB NOT NULL,
+ page_is_redirect SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ page_is_new SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ page_random DOUBLE PRECISION NOT NULL,
+ page_touched BLOB NOT NULL, page_links_updated BLOB DEFAULT NULL,
+ page_latest INTEGER UNSIGNED NOT NULL,
+ page_len INTEGER UNSIGNED NOT NULL,
+ page_content_model BLOB DEFAULT NULL,
+ page_lang BLOB DEFAULT NULL
+);
+
+CREATE UNIQUE INDEX page_name_title ON /*_*/page (page_namespace, page_title);
+
+CREATE INDEX page_random ON /*_*/page (page_random);
+
+CREATE INDEX page_len ON /*_*/page (page_len);
+
+CREATE INDEX page_redirect_namespace_len ON /*_*/page (
+ page_is_redirect, page_namespace,
+ page_len
+);
+
+
+CREATE TABLE /*_*/user (
+ user_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ user_name BLOB DEFAULT '' NOT NULL,
+ user_real_name BLOB DEFAULT '' NOT NULL,
+ user_password BLOB NOT NULL, user_newpassword BLOB NOT NULL,
+ user_newpass_time BLOB DEFAULT NULL,
+ user_email CLOB NOT NULL, user_touched BLOB NOT NULL,
+ user_token BLOB DEFAULT '' NOT NULL,
+ user_email_authenticated BLOB DEFAULT NULL,
+ user_email_token BLOB DEFAULT NULL,
+ user_email_token_expires BLOB DEFAULT NULL,
+ user_registration BLOB DEFAULT NULL,
+ user_editcount INTEGER UNSIGNED DEFAULT NULL,
+ user_password_expires BLOB DEFAULT NULL,
+ user_is_temp SMALLINT DEFAULT 0 NOT NULL
+);
+
+CREATE UNIQUE INDEX user_name ON /*_*/user (user_name);
+
+CREATE INDEX user_email_token ON /*_*/user (user_email_token);
+
+CREATE INDEX user_email ON /*_*/user (user_email);
+
+
+CREATE TABLE /*_*/user_autocreate_serial (
+ uas_shard INTEGER UNSIGNED NOT NULL,
+ uas_year SMALLINT UNSIGNED NOT NULL,
+ uas_value INTEGER UNSIGNED NOT NULL,
+ PRIMARY KEY(uas_shard, uas_year)
+);
+
+
+CREATE TABLE /*_*/revision (
+ rev_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ rev_page INTEGER UNSIGNED NOT NULL,
+ rev_comment_id BIGINT UNSIGNED NOT NULL,
+ rev_actor BIGINT UNSIGNED NOT NULL,
+ rev_timestamp BLOB NOT NULL, rev_minor_edit SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rev_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
+ rev_len INTEGER UNSIGNED DEFAULT NULL,
+ rev_parent_id BIGINT UNSIGNED DEFAULT NULL,
+ rev_sha1 BLOB DEFAULT '' NOT NULL
+);
+
+CREATE INDEX rev_timestamp ON /*_*/revision (rev_timestamp);
+
+CREATE INDEX rev_page_timestamp ON /*_*/revision (rev_page, rev_timestamp);
+
+CREATE INDEX rev_actor_timestamp ON /*_*/revision (rev_actor, rev_timestamp, rev_id);
+
+CREATE INDEX rev_page_actor_timestamp ON /*_*/revision (
+ rev_page, rev_actor, rev_timestamp
+);
+
+
+CREATE TABLE /*_*/searchindex (
+ si_page INTEGER UNSIGNED NOT NULL,
+ si_title CLOB NOT NULL,
+ si_text CLOB NOT NULL,
+ PRIMARY KEY(si_page)
+);
+
+CREATE INDEX si_title ON /*_*/searchindex (si_title);
+
+CREATE INDEX si_text ON /*_*/searchindex (si_text);
+
+
+CREATE TABLE /*_*/linktarget (
+ lt_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ lt_namespace INTEGER NOT NULL, lt_title BLOB NOT NULL
+);
+
+CREATE UNIQUE INDEX lt_namespace_title ON /*_*/linktarget (lt_namespace, lt_title);