diff options
author | Daimona Eaytoy <daimona.wiki@gmail.com> | 2024-12-12 22:57:31 +0100 |
---|---|---|
committer | Daimona Eaytoy <daimona.wiki@gmail.com> | 2024-12-13 03:12:56 +0100 |
commit | 251f4395865f8a33bcf32c6faa11748a14753492 (patch) | |
tree | 951d03a3860e9e1851cfe8e3c1ee8ea0c4217c29 /sql | |
parent | 589f6d5a40d7bf65250f174be1318a077733c5f5 (diff) | |
download | mediawikicore-251f4395865f8a33bcf32c6faa11748a14753492.tar.gz mediawikicore-251f4395865f8a33bcf32c6faa11748a14753492.zip |
Move SQL schema and schema changes to new sql/ top-level directory
This is the standard in every extension. DB schema changes are not
maintenance scripts, and therefore there's no apparent reason to have
the two things together, besides historical reasons.
Also, put each DB type in a separate directory, which wasn't the case
for MySQL before. For SQLite and Postgres schema changes, we now
follow the convention (used everywhere else, including the
generateSchemaChangeSql script) of having the DB type as the last part
of the path. This lets us generate schema changes for all DB types at
once, and without specifying the full file path.
Most files are just being renamed, the exceptions being to update
references to the old location (sometimes still referencing tables.sql).
Note that the old path is still referenced in the autogenerated comment
of schema changes SQL files. These will be regenerated in another
commit. Instead, the schema files are done now, because they're covered
by DatabaseIntegrationTest that would otherwise fail.
Bug: T382030
Change-Id: I3b4a614366d0bc629523ac40ce97d001f3b6bcf8
Diffstat (limited to 'sql')
247 files changed, 18658 insertions, 0 deletions
diff --git a/sql/.htaccess b/sql/.htaccess new file mode 100644 index 000000000000..b66e80882967 --- /dev/null +++ b/sql/.htaccess @@ -0,0 +1 @@ +Require all denied diff --git a/sql/abstractSchemaChanges/patch-change_tag-ct_rc_id.json b/sql/abstractSchemaChanges/patch-change_tag-ct_rc_id.json new file mode 100644 index 000000000000..7f03469e3fbd --- /dev/null +++ b/sql/abstractSchemaChanges/patch-change_tag-ct_rc_id.json @@ -0,0 +1,108 @@ +{ + "before": { + "name": "change_tag", + "comment": "A table to track tags for revisions, logs and recent changes", + "columns": [ + { + "name": "ct_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "ct_rc_id", + "comment": "RCID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_log_id", + "comment": "LOGID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_rev_id", + "comment": "REVID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_params", + "comment": "Parameters for the tag; used by some extensions", + "type": "blob", + "options": { "length": 65530, "notnull": false, "default": null } + }, + { + "name": "ct_tag_id", + "comment": "Foreign key to change_tag_def row", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + } + ], + "indexes": [ + { "name": "ct_rc_tag_id", "columns": [ "ct_rc_id", "ct_tag_id" ], "unique": true }, + { "name": "ct_log_tag_id", "columns": [ "ct_log_id", "ct_tag_id" ], "unique": true }, + { "name": "ct_rev_tag_id", "columns": [ "ct_rev_id", "ct_tag_id" ], "unique": true }, + { + "name": "ct_tag_id_id", + "comment": "Covering index, so we can pull all the info only out of the index.", + "columns": [ "ct_tag_id", "ct_rc_id", "ct_rev_id", "ct_log_id" ], + "unique": false + } + ], + "pk": [ "ct_id" ] + }, + "after": { + "name": "change_tag", + "comment": "A table to track tags for revisions, logs and recent changes", + "columns": [ + { + "name": "ct_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "ct_rc_id", + "comment": "RCID for the change", + "type": "bigint", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_log_id", + "comment": "LOGID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_rev_id", + "comment": "REVID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_params", + "comment": "Parameters for the tag; used by some extensions", + "type": "blob", + "options": { "length": 65530, "notnull": false, "default": null } + }, + { + "name": "ct_tag_id", + "comment": "Foreign key to change_tag_def row", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + } + ], + "indexes": [ + { "name": "ct_rc_tag_id", "columns": [ "ct_rc_id", "ct_tag_id" ], "unique": true }, + { "name": "ct_log_tag_id", "columns": [ "ct_log_id", "ct_tag_id" ], "unique": true }, + { "name": "ct_rev_tag_id", "columns": [ "ct_rev_id", "ct_tag_id" ], "unique": true }, + { + "name": "ct_tag_id_id", + "comment": "Covering index, so we can pull all the info only out of the index.", + "columns": [ "ct_tag_id", "ct_rc_id", "ct_rev_id", "ct_log_id" ], + "unique": false + } + ], + "pk": [ "ct_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-change_tag-rename-indexes.json b/sql/abstractSchemaChanges/patch-change_tag-rename-indexes.json new file mode 100644 index 000000000000..2d4e51f98fb8 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-change_tag-rename-indexes.json @@ -0,0 +1,109 @@ +{ + "comment": "Rename all indexes to have uniform ct_ prefix (T270033)", + "before": { + "name": "change_tag", + "comment": "A table to track tags for revisions, logs and recent changes", + "columns": [ + { + "name": "ct_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "ct_rc_id", + "comment": "RCID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_log_id", + "comment": "LOGID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_rev_id", + "comment": "REVID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_params", + "comment": "Parameters for the tag; used by some extensions", + "type": "blob", + "options": { "length": 65530, "notnull": false, "default": null } + }, + { + "name": "ct_tag_id", + "comment": "Foreign key to change_tag_def row", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + } + ], + "indexes": [ + { "name": "change_tag_rc_tag_id", "columns": [ "ct_rc_id", "ct_tag_id" ], "unique": true }, + { "name": "change_tag_log_tag_id", "columns": [ "ct_log_id", "ct_tag_id" ], "unique": true }, + { "name": "change_tag_rev_tag_id", "columns": [ "ct_rev_id", "ct_tag_id" ], "unique": true }, + { + "name": "change_tag_tag_id_id", + "comment": "Covering index, so we can pull all the info only out of the index.", + "columns": [ "ct_tag_id", "ct_rc_id", "ct_rev_id", "ct_log_id" ], + "unique": false + } + ], + "pk": [ "ct_id" ] + }, + "after": { + "name": "change_tag", + "comment": "A table to track tags for revisions, logs and recent changes", + "columns": [ + { + "name": "ct_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "ct_rc_id", + "comment": "RCID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_log_id", + "comment": "LOGID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_rev_id", + "comment": "REVID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_params", + "comment": "Parameters for the tag; used by some extensions", + "type": "blob", + "options": { "length": 65530, "notnull": false, "default": null } + }, + { + "name": "ct_tag_id", + "comment": "Foreign key to change_tag_def row", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + } + ], + "indexes": [ + { "name": "ct_rc_tag_id", "columns": [ "ct_rc_id", "ct_tag_id" ], "unique": true }, + { "name": "ct_log_tag_id", "columns": [ "ct_log_id", "ct_tag_id" ], "unique": true }, + { "name": "ct_rev_tag_id", "columns": [ "ct_rev_id", "ct_tag_id" ], "unique": true }, + { + "name": "ct_tag_id_id", + "comment": "Covering index, so we can pull all the info only out of the index.", + "columns": [ "ct_tag_id", "ct_rc_id", "ct_rev_id", "ct_log_id" ], + "unique": false + } + ], + "pk": [ "ct_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-drop-cl_collation_ext.json b/sql/abstractSchemaChanges/patch-drop-cl_collation_ext.json new file mode 100644 index 000000000000..7c43262f89ed --- /dev/null +++ b/sql/abstractSchemaChanges/patch-drop-cl_collation_ext.json @@ -0,0 +1,143 @@ +{ + "comment": "Drop cl_collation_ext index from categorylinks (T342854)", + "before": { + "name": "categorylinks", + "comment": "Track category inclusions *used inline* This tracks a single level of category membership", + "columns": [ + { + "name": "cl_from", + "comment": "Key to page_id of the page defined as a category member.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "cl_to", + "comment": "Name of the category. This is also the page_title of the category's description page; all such pages are in namespace 14 (NS_CATEGORY).", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 255 } + }, + { + "name": "cl_sortkey", + "comment": "A binary string obtained by applying a sortkey generation algorithm (Collation::getSortKey()) to page_title, or cl_sortkey_prefix . \"\\n\" page_title if cl_sortkey_prefix is nonempty.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 230 } + }, + { + "name": "cl_sortkey_prefix", + "comment": "A prefix for the raw sortkey manually specified by the user, either via [[Category:Foo|prefix]] or {{defaultsort:prefix}}. If nonempty, it's concatenated with a line break followed by the page title before the sortkey conversion algorithm is run. We store this so that we can update collations without reparsing all pages. Note: If you change the length of this field, you also need to change code in LinksUpdate.php. See T27254.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 255 } + }, + { + "name": "cl_timestamp", + "comment": "This isn't really used at present. Provided for an optional sorting method by approximate addition time.", + "type": "datetimetz", + "options": { "notnull": true, "PlatformOptions": { "version": true } } + }, + { + "name": "cl_collation", + "comment": "Stores $wgCategoryCollation at the time cl_sortkey was generated. This can be used to install new collation versions, tracking which rows are not yet updated. '' means no collation, this is a legacy row that needs to be updated by updateCollation.php. In the future, it might be possible to specify different collations per category.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32 } + }, + { + "name": "cl_type", + "comment": "Stores whether cl_from is a category, file, or other page, so we can paginate the three categories separately. This only has to be updated when moving pages into or out of the category namespace, since file pages cannot be moved to other namespaces, nor can non-files be moved into the file namespace.", + "type": "mwenum", + "options": { "notnull": true, "default": "page", + "CustomSchemaOptions": { + "enum_values": [ "page", "subcat", "file" ] + } + } + } + ], + "indexes": [ + { + "name": "cl_sortkey", + "comment": "We always sort within a given category, and within a given type. FIXME: Formerly this index didn't cover cl_type (since that didn't exist), so old callers won't be using an index: fix this?", + "columns": [ "cl_to", "cl_type", "cl_sortkey", "cl_from" ], + "unique": false + }, + { + "name": "cl_timestamp", + "comment": "Used by the API (and some extensions)", + "columns": [ "cl_to", "cl_timestamp" ], + "unique": false + }, + { + "name": "cl_collation_ext", + "comment": "Used when updating collation (e.g. updateCollation.php)", + "columns": [ "cl_collation", "cl_to", "cl_type", "cl_from" ], + "unique": false + } + ], + "pk": [ "cl_from", "cl_to" ] + }, + "after": { + "name": "categorylinks", + "comment": "Track category inclusions *used inline* This tracks a single level of category membership", + "columns": [ + { + "name": "cl_from", + "comment": "Key to page_id of the page defined as a category member.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "cl_to", + "comment": "Name of the category. This is also the page_title of the category's description page; all such pages are in namespace 14 (NS_CATEGORY).", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 255 } + }, + { + "name": "cl_sortkey", + "comment": "A binary string obtained by applying a sortkey generation algorithm (Collation::getSortKey()) to page_title, or cl_sortkey_prefix . \"\\n\" page_title if cl_sortkey_prefix is nonempty.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 230 } + }, + { + "name": "cl_sortkey_prefix", + "comment": "A prefix for the raw sortkey manually specified by the user, either via [[Category:Foo|prefix]] or {{defaultsort:prefix}}. If nonempty, it's concatenated with a line break followed by the page title before the sortkey conversion algorithm is run. We store this so that we can update collations without reparsing all pages. Note: If you change the length of this field, you also need to change code in LinksUpdate.php. See T27254.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 255 } + }, + { + "name": "cl_timestamp", + "comment": "This isn't really used at present. Provided for an optional sorting method by approximate addition time.", + "type": "datetimetz", + "options": { "notnull": true, "PlatformOptions": { "version": true } } + }, + { + "name": "cl_collation", + "comment": "Stores $wgCategoryCollation at the time cl_sortkey was generated. This can be used to install new collation versions, tracking which rows are not yet updated. '' means no collation, this is a legacy row that needs to be updated by updateCollation.php. In the future, it might be possible to specify different collations per category.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32 } + }, + { + "name": "cl_type", + "comment": "Stores whether cl_from is a category, file, or other page, so we can paginate the three categories separately. This only has to be updated when moving pages into or out of the category namespace, since file pages cannot be moved to other namespaces, nor can non-files be moved into the file namespace.", + "type": "mwenum", + "options": { "notnull": true, "default": "page", + "CustomSchemaOptions": { + "enum_values": [ "page", "subcat", "file" ] + } + } + } + ], + "indexes": [ + { + "name": "cl_sortkey", + "comment": "We always sort within a given category, and within a given type. FIXME: Formerly this index didn't cover cl_type (since that didn't exist), so old callers won't be using an index: fix this?", + "columns": [ "cl_to", "cl_type", "cl_sortkey", "cl_from" ], + "unique": false + }, + { + "name": "cl_timestamp", + "comment": "Used by the API (and some extensions)", + "columns": [ "cl_to", "cl_timestamp" ], + "unique": false + } + ], + "pk": [ "cl_from", "cl_to" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-drop-ct_tag.json b/sql/abstractSchemaChanges/patch-drop-ct_tag.json new file mode 100644 index 000000000000..08c102f041e0 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-drop-ct_tag.json @@ -0,0 +1,124 @@ +{ + "comment": "Drop change_tag.ct_tag field (T185355)", + "before": { + "name": "change_tag", + "comment": "A table to track tags for revisions, logs and recent changes", + "columns": [ + { + "name": "ct_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "ct_rc_id", + "comment": "RCID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_log_id", + "comment": "LOGID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_rev_id", + "comment": "REVID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_tag", + "comment": "Tag applied, this will go away and be replaced with ct_tag_id", + "type": "string", + "options": { "length": 255, "notnull": true, "default": "" } + }, + { + "name": "ct_params", + "comment": "Parameters for the tag; used by some extensions", + "type": "blob", + "options": { "length": 65530, "notnull": false, "default": null } + }, + { + "name": "ct_tag_id", + "comment": "Foreign key to change_tag_def row", + "type": "integer", + "options": { "unsigned": false, "notnull": true } + } + ], + "indexes": [ + { "name": "change_tag_rc_tag_id", "columns": [ "ct_rc_id", "ct_tag_id" ], "unique": true }, + { "name": "change_tag_log_tag_id", "columns": [ "ct_log_id", "ct_tag_id" ], "unique": true }, + { "name": "change_tag_rev_tag_id", "columns": [ "ct_rev_id", "ct_tag_id" ], "unique": true }, + { "name": "change_tag_rc_tag_nonuniq", "columns": [ "ct_rc_id", "ct_tag" ], "unique": true }, + { "name": "change_tag_log_tag_nonuniq", "columns": [ "ct_log_id", "ct_tag" ], "unique": true }, + { "name": "change_tag_rev_tag_nonuniq", "columns": [ "ct_rev_id", "ct_tag" ], "unique": true }, + { + "name": "change_tag_tag_id", + "comment": "Covering index, so we can pull all the info only out of the index.", + "columns": [ "ct_tag", "ct_rc_id", "ct_rev_id", "ct_log_id" ], + "unique": false + }, + { + "name": "change_tag_tag_id_id", + "comment": "Covering index, so we can pull all the info only out of the index.", + "columns": [ "ct_tag_id", "ct_rc_id", "ct_rev_id", "ct_log_id" ], + "unique": false + } + ], + "pk": [ "ct_id" ] + }, + "after": { + "name": "change_tag", + "comment": "A table to track tags for revisions, logs and recent changes", + "columns": [ + { + "name": "ct_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "ct_rc_id", + "comment": "RCID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_log_id", + "comment": "LOGID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_rev_id", + "comment": "REVID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_params", + "comment": "Parameters for the tag; used by some extensions", + "type": "blob", + "options": { "length": 65530, "notnull": false, "default": null } + }, + { + "name": "ct_tag_id", + "comment": "Foreign key to change_tag_def row", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + } + ], + "indexes": [ + { "name": "change_tag_rc_tag_id", "columns": [ "ct_rc_id", "ct_tag_id" ], "unique": true }, + { "name": "change_tag_log_tag_id", "columns": [ "ct_log_id", "ct_tag_id" ], "unique": true }, + { "name": "change_tag_rev_tag_id", "columns": [ "ct_rev_id", "ct_tag_id" ], "unique": true }, + { + "name": "change_tag_tag_id_id", + "comment": "Covering index, so we can pull all the info only out of the index.", + "columns": [ "ct_tag_id", "ct_rc_id", "ct_rev_id", "ct_log_id" ], + "unique": false + } + ], + "pk": [ "ct_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-drop-page_restrictions-pr_user.json b/sql/abstractSchemaChanges/patch-drop-page_restrictions-pr_user.json new file mode 100644 index 000000000000..7f3a8dc0cf9a --- /dev/null +++ b/sql/abstractSchemaChanges/patch-drop-page_restrictions-pr_user.json @@ -0,0 +1,115 @@ +{ + "comment": "Drop page_restrictions.pr_user field (T199377)", + "before": { + "name": "page_restrictions", + "comment": "Used for storing page restrictions (i.e. protection levels)", + "columns": [ + { + "name": "pr_id", + "comment": "Field for an ID for this restrictions row (sort-key for Special:ProtectedPages)", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "pr_page", + "comment": "Page to apply restrictions to (Foreign Key to page).", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "pr_type", + "comment": "The protection type (edit, move, etc)", + "type": "binary", + "options": { "length": 60, "notnull": true } + }, + { + "name": "pr_level", + "comment": "The protection level (Sysop, autoconfirmed, etc)", + "type": "binary", + "options": { "length": 60, "notnull": true } + }, + { + "name": "pr_cascade", + "type": "mwtinyint", + "options": { "notnull": true } + }, + { + "name": "pr_user", + "comment": "Field for future support of per-user restriction.", + "type": "integer", + "options": { "notnull": false, "unsigned": true } + }, + { + "name": "pr_expiry", + "comment": "Field for time-limited protection.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + } + ], + "indexes": [ + { "name": "pr_pagetype", "columns": [ "pr_page", "pr_type" ], "unique": true }, + { "name": "pr_typelevel", "columns": [ "pr_type", "pr_level" ], "unique": false }, + { "name": "pr_level", "columns": [ "pr_level" ], "unique": false }, + { "name": "pr_cascade", "columns": [ "pr_cascade" ], "unique": false } + ], + "pk": [ "pr_id" ] + }, + "after": { + "name": "page_restrictions", + "comment": "Used for storing page restrictions (i.e. protection levels)", + "columns": [ + { + "name": "pr_id", + "comment": "Field for an ID for this restrictions row (sort-key for Special:ProtectedPages)", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "pr_page", + "comment": "Page to apply restrictions to (Foreign Key to page).", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "pr_type", + "comment": "The protection type (edit, move, etc)", + "type": "binary", + "options": { "length": 60, "notnull": true } + }, + { + "name": "pr_level", + "comment": "The protection level (Sysop, autoconfirmed, etc)", + "type": "binary", + "options": { "length": 60, "notnull": true } + }, + { + "name": "pr_cascade", + "type": "mwtinyint", + "options": { "notnull": true } + }, + { + "name": "pr_expiry", + "comment": "Field for time-limited protection.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + } + ], + "indexes": [ + { "name": "pr_pagetype", "columns": [ "pr_page", "pr_type" ], "unique": true }, + { "name": "pr_typelevel", "columns": [ "pr_type", "pr_level" ], "unique": false }, + { "name": "pr_level", "columns": [ "pr_level" ], "unique": false }, + { "name": "pr_cascade", "columns": [ "pr_cascade" ], "unique": false } + ], + "pk": [ "pr_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-drop-rev_page_id.json b/sql/abstractSchemaChanges/patch-drop-rev_page_id.json new file mode 100644 index 000000000000..0348193b9bc3 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-drop-rev_page_id.json @@ -0,0 +1,195 @@ +{ + "comment": "Drop rev_page_id index on revision (T163532)", + "before": { + "name": "revision", + "comment": "Every edit of a page creates also a revision row. This stores metadata about the revision, and a reference to the text storage backend.", + "columns": [ + { + "name": "rev_id", + "comment": "Unique ID to identify each revision", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "rev_page", + "comment": "Key to page_id. This should never be invalid", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "rev_comment_id", + "comment": "Key to comment.comment_id. Comment summarizing the change", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "rev_actor", + "comment": "Key to actor.actor_id of the user or IP who made this edit", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "rev_timestamp", + "comment": "Timestamp of when revision was created", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "rev_minor_edit", + "comment": "Records whether the user marked the 'minor edit' checkbox. Many automated edits are marked as minor", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rev_deleted", + "comment": "Restrictions on who can access this revision", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rev_len", + "comment": "Length of this revision in bytes", + "type": "integer", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "rev_parent_id", + "comment": "Key to revision.rev_id. This field is used to add support for a tree structure (The Adjacency List Model)", + "type": "integer", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "rev_sha1", + "comment": "SHA-1 text content hash in base-36", + "type": "binary", + "options": { "length": 32, "notnull": true, "default": "" } + } + ], + "indexes": [ + { + "name": "rev_page_id", + "columns": [ "rev_page", "rev_id" ], + "comment": "The index is proposed for removal, do not use it in new code: T163532. Used for ordering revisions within a page by rev_id, which is usually incorrect, since rev_timestamp is normally the correct order. It can also be used by dumpBackup.php, if a page and rev_id range is specified.", + "unique": false + }, + { + "name": "rev_timestamp", + "columns": [ "rev_timestamp" ], + "comment": "Used by ApiQueryAllRevisions", + "unique": false + }, + { + "name": "rev_page_timestamp", + "columns": [ "rev_page", "rev_timestamp" ], + "comment": "History index", + "unique": false + }, + { + "name": "rev_actor_timestamp", + "columns": [ "rev_actor", "rev_timestamp", "rev_id" ], + "comment": "User contributions index", + "unique": false + }, + { + "name": "rev_page_actor_timestamp", + "columns": [ "rev_page", "rev_actor", "rev_timestamp" ], + "comment": "Credits index. This is scanned in order to compile credits lists for pages, in ApiQueryContributors. Also for ApiQueryRevisions if rvuser is specified", + "unique": false + } + ], + "pk": [ "rev_id" ] + }, + "after": { + "name": "revision", + "comment": "Every edit of a page creates also a revision row. This stores metadata about the revision, and a reference to the text storage backend.", + "columns": [ + { + "name": "rev_id", + "comment": "Unique ID to identify each revision", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "rev_page", + "comment": "Key to page_id. This should never be invalid", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "rev_comment_id", + "comment": "Key to comment.comment_id. Comment summarizing the change", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "rev_actor", + "comment": "Key to actor.actor_id of the user or IP who made this edit", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "rev_timestamp", + "comment": "Timestamp of when revision was created", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "rev_minor_edit", + "comment": "Records whether the user marked the 'minor edit' checkbox. Many automated edits are marked as minor", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rev_deleted", + "comment": "Restrictions on who can access this revision", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rev_len", + "comment": "Length of this revision in bytes", + "type": "integer", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "rev_parent_id", + "comment": "Key to revision.rev_id. This field is used to add support for a tree structure (The Adjacency List Model)", + "type": "integer", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "rev_sha1", + "comment": "SHA-1 text content hash in base-36", + "type": "binary", + "options": { "length": 32, "notnull": true, "default": "" } + } + ], + "indexes": [ + { + "name": "rev_timestamp", + "columns": [ "rev_timestamp" ], + "comment": "Used by ApiQueryAllRevisions", + "unique": false + }, + { + "name": "rev_page_timestamp", + "columns": [ "rev_page", "rev_timestamp" ], + "comment": "History index", + "unique": false + }, + { + "name": "rev_actor_timestamp", + "columns": [ "rev_actor", "rev_timestamp", "rev_id" ], + "comment": "User contributions index", + "unique": false + }, + { + "name": "rev_page_actor_timestamp", + "columns": [ "rev_page", "rev_actor", "rev_timestamp" ], + "comment": "Credits index. This is scanned in order to compile credits lists for pages, in ApiQueryContributors. Also for ApiQueryRevisions if rvuser is specified", + "unique": false + } + ], + "pk": [ "rev_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-extend-iwlinks-iwl_prefix.json b/sql/abstractSchemaChanges/patch-extend-iwlinks-iwl_prefix.json new file mode 100644 index 000000000000..96c08bbc1b29 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-extend-iwlinks-iwl_prefix.json @@ -0,0 +1,81 @@ +{ + "comment": "T275242 - increase size of iwl_prefix from VARBINARY(20) to VARBINARY(32)", + "before": { + "name": "iwlinks", + "comment": "Track inline interwiki links", + "columns": [ + { + "name": "iwl_from", + "comment": "page_id of the referring page", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "iwl_prefix", + "type": "binary", + "comment": "Interwiki prefix code of the target", + "options": { "notnull": true, "length": 20, "default": "" } + }, + { + "name": "iwl_title", + "type": "binary", + "comment": "Title of the target, including namespace", + "options": { "notnull": true, "length": 255, "default": "" } + } + ], + "indexes": [ + { + "name": "iwl_prefix_title_from", + "columns": [ "iwl_prefix", "iwl_title", "iwl_from" ], + "comment": "Index for ApiQueryIWBacklinks", + "unique": false + }, + { + "name": "iwl_prefix_from_title", + "columns": [ "iwl_prefix", "iwl_from", "iwl_title" ], + "comment": "Index for ApiQueryIWLinks", + "unique": false + } + ], + "pk": [ "iwl_from", "iwl_prefix", "iwl_title" ] + }, + "after": { + "name": "iwlinks", + "comment": "Track inline interwiki links", + "columns": [ + { + "name": "iwl_from", + "comment": "page_id of the referring page", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "iwl_prefix", + "type": "binary", + "comment": "Interwiki prefix code of the target", + "options": { "notnull": true, "length": 32, "default": "" } + }, + { + "name": "iwl_title", + "type": "binary", + "comment": "Title of the target, including namespace", + "options": { "notnull": true, "length": 255, "default": "" } + } + ], + "indexes": [ + { + "name": "iwl_prefix_title_from", + "columns": [ "iwl_prefix", "iwl_title", "iwl_from" ], + "comment": "Index for ApiQueryIWBacklinks", + "unique": false + }, + { + "name": "iwl_prefix_from_title", + "columns": [ "iwl_prefix", "iwl_from", "iwl_title" ], + "comment": "Index for ApiQueryIWLinks", + "unique": false + } + ], + "pk": [ "iwl_from", "iwl_prefix", "iwl_title" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-externallinks-drop-el_to.json b/sql/abstractSchemaChanges/patch-externallinks-drop-el_to.json new file mode 100644 index 000000000000..cfbc07e27e45 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-externallinks-drop-el_to.json @@ -0,0 +1,93 @@ +{ + "comment": "Drop old columns of externallinks (T312666)", + "before": { + "name": "externallinks", + "comment": "Track links to external URLs", + "columns": [ + { + "name": "el_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "el_from", + "type": "integer", + "comment": "page_id of the referring page", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "el_to", + "type": "blob", + "comment": "The external link", + "options": { "length": 65530, "notnull": false, "default": "" } + }, + { + "name": "el_index", + "type": "blob", + "comment": "In the case of HTTP URLs, this is the URL with any username or password removed, and with the labels in the hostname reversed and converted to lower case which will allow faster searching for all pages with WHERE clause. Note: If PHP's intl extension is enabled/disabled, maintenance/refreshExternallinksIndex.php needs to be run to refresh this field", + "options": { "length": 65530, "notnull": false, "default": "" } + }, + { + "name": "el_index_60", + "type": "binary", + "comment": "'el_index' truncated to 60 bytes to allow for sortable queries that aren't supported by a partial index", + "options": { "notnull": true, "length": 60, "default": "" } + }, + { + "name": "el_to_domain_index", + "type": "binary", + "comment": "Indexable domain", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "el_to_path", + "type": "blob", + "comment": "Path to the external link without considering the domain", + "options": { "length": 65530, "notnull": false } + } + ], + "indexes": [ + { "name": "el_from", "columns": [ "el_from" ], "unique": false }, + { "name": "el_to", "columns": [ "el_to", "el_from" ], "unique": false, "options": { "lengths": [ 60, null ] } }, + { "name": "el_index", "columns": [ "el_index" ], "unique": false, "options": { "lengths": [ 60 ] } }, + { "name": "el_index_60", "columns": [ "el_index_60", "el_id" ], "unique": false }, + { "name": "el_from_index_60", "columns": [ "el_from", "el_index_60", "el_id" ], "unique": false }, + { "name": "el_to_domain_index_to_path", "columns": [ "el_to_domain_index", "el_to_path" ], "unique": false, "options": { "lengths": [ null, 60 ] } } + ], + "pk": [ "el_id" ] + }, + "after": { + "name": "externallinks", + "comment": "Track links to external URLs", + "columns": [ + { + "name": "el_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "el_from", + "type": "integer", + "comment": "page_id of the referring page", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "el_to_domain_index", + "type": "binary", + "comment": "Indexable domain", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "el_to_path", + "type": "blob", + "comment": "Path to the external link without considering the domain", + "options": { "length": 65530, "notnull": false } + } + ], + "indexes": [ + { "name": "el_from", "columns": [ "el_from" ], "unique": false }, + { "name": "el_to_domain_index_to_path", "columns": [ "el_to_domain_index", "el_to_path" ], "unique": false, "options": { "lengths": [ null, 60 ] } } + ], + "pk": [ "el_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-externallinks-el_to_default.json b/sql/abstractSchemaChanges/patch-externallinks-el_to_default.json new file mode 100644 index 000000000000..7f1164fb20dd --- /dev/null +++ b/sql/abstractSchemaChanges/patch-externallinks-el_to_default.json @@ -0,0 +1,115 @@ +{ + "comment": "Set default for old externallinks columns in preparation of dropping them (T312666).", + "before": { + "name": "externallinks", + "comment": "Track links to external URLs", + "columns": [ + { + "name": "el_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "el_from", + "type": "integer", + "comment": "page_id of the referring page", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "el_to", + "type": "blob", + "comment": "The external link", + "options": { "length": 65530, "notnull": true } + }, + { + "name": "el_index", + "type": "blob", + "comment": "In the case of HTTP URLs, this is the URL with any username or password removed, and with the labels in the hostname reversed and converted to lower case which will allow faster searching for all pages with WHERE clause. Note: If PHP's intl extension is enabled/disabled, maintenance/refreshExternallinksIndex.php needs to be run to refresh this field", + "options": { "length": 65530, "notnull": true } + }, + { + "name": "el_index_60", + "type": "binary", + "comment": "'el_index' truncated to 60 bytes to allow for sortable queries that aren't supported by a partial index", + "options": { "notnull": true, "length": 60 } + }, + { + "name": "el_to_domain_index", + "type": "binary", + "comment": "Indexable domain", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "el_to_path", + "type": "blob", + "comment": "Path to the external link without considering the domain", + "options": { "length": 65530, "notnull": false } + } + ], + "indexes": [ + { "name": "el_from", "columns": [ "el_from" ], "unique": false }, + { "name": "el_to", "columns": [ "el_to", "el_from" ], "unique": false, "options": { "lengths": [ 60, null ] } }, + { "name": "el_index", "columns": [ "el_index" ], "unique": false, "options": { "lengths": [ 60 ] } }, + { "name": "el_index_60", "columns": [ "el_index_60", "el_id" ], "unique": false }, + { "name": "el_from_index_60", "columns": [ "el_from", "el_index_60", "el_id" ], "unique": false }, + { "name": "el_to_domain_index_to_path", "columns": [ "el_to_domain_index", "el_to_path" ], "unique": false, "options": { "lengths": [ null, 60 ] } } + ], + "pk": [ "el_id" ] + }, + "after": { + "name": "externallinks", + "comment": "Track links to external URLs", + "columns": [ + { + "name": "el_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "el_from", + "type": "integer", + "comment": "page_id of the referring page", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "el_to", + "type": "blob", + "comment": "The external link", + "options": { "length": 65530, "notnull": false, "default": "" } + }, + { + "name": "el_index", + "type": "blob", + "comment": "In the case of HTTP URLs, this is the URL with any username or password removed, and with the labels in the hostname reversed and converted to lower case which will allow faster searching for all pages with WHERE clause. Note: If PHP's intl extension is enabled/disabled, maintenance/refreshExternallinksIndex.php needs to be run to refresh this field", + "options": { "length": 65530, "notnull": false, "default": "" } + }, + { + "name": "el_index_60", + "type": "binary", + "comment": "'el_index' truncated to 60 bytes to allow for sortable queries that aren't supported by a partial index", + "options": { "notnull": true, "length": 60, "default": "" } + }, + { + "name": "el_to_domain_index", + "type": "binary", + "comment": "Indexable domain", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "el_to_path", + "type": "blob", + "comment": "Path to the external link without considering the domain", + "options": { "length": 65530, "notnull": false } + } + ], + "indexes": [ + { "name": "el_from", "columns": [ "el_from" ], "unique": false }, + { "name": "el_to", "columns": [ "el_to", "el_from" ], "unique": false, "options": { "lengths": [ 60, null ] } }, + { "name": "el_index", "columns": [ "el_index" ], "unique": false, "options": { "lengths": [ 60 ] } }, + { "name": "el_index_60", "columns": [ "el_index_60", "el_id" ], "unique": false }, + { "name": "el_from_index_60", "columns": [ "el_from", "el_index_60", "el_id" ], "unique": false }, + { "name": "el_to_domain_index_to_path", "columns": [ "el_to_domain_index", "el_to_path" ], "unique": false, "options": { "lengths": [ null, 60 ] } } + ], + "pk": [ "el_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-externallinks-el_to_path.json b/sql/abstractSchemaChanges/patch-externallinks-el_to_path.json new file mode 100644 index 000000000000..77fb3b76e21c --- /dev/null +++ b/sql/abstractSchemaChanges/patch-externallinks-el_to_path.json @@ -0,0 +1,102 @@ +{ + "comment": "Set unsigned true for ipb_id and ipb_parent_block_id in ipblocks table", + "before": { + "name": "externallinks", + "comment": "Track links to external URLs", + "columns": [ + { + "name": "el_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "el_from", + "type": "integer", + "comment": "page_id of the referring page", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "el_to", + "type": "blob", + "comment": "The external link", + "options": { "length": 65530, "notnull": true } + }, + { + "name": "el_index", + "type": "blob", + "comment": "In the case of HTTP URLs, this is the URL with any username or password removed, and with the labels in the hostname reversed and converted to lower case which will allow faster searching for all pages with WHERE clause. Note: If PHP's intl extension is enabled/disabled, maintenance/refreshExternallinksIndex.php needs to be run to refresh this field", + "options": { "length": 65530, "notnull": true } + }, + { + "name": "el_index_60", + "type": "binary", + "comment": "'el_index' truncated to 60 bytes to allow for sortable queries that aren't supported by a partial index", + "options": { "notnull": true, "length": 60 } + } + ], + "indexes": [ + { "name": "el_from", "columns": [ "el_from", "el_to" ], "unique": false, "options": { "lengths": [ null, 40 ] } }, + { "name": "el_to", "columns": [ "el_to", "el_from" ], "unique": false, "options": { "lengths": [ 60, null ] } }, + { "name": "el_index", "columns": [ "el_index" ], "unique": false, "options": { "lengths": [ 60 ] } }, + { "name": "el_index_60", "columns": [ "el_index_60", "el_id" ], "unique": false }, + { "name": "el_from_index_60", "columns": [ "el_from", "el_index_60", "el_id" ], "unique": false } + ], + "pk": [ "el_id" ] + }, + "after": { + "name": "externallinks", + "comment": "Track links to external URLs", + "columns": [ + { + "name": "el_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "el_from", + "type": "integer", + "comment": "page_id of the referring page", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "el_to", + "type": "blob", + "comment": "The external link", + "options": { "length": 65530, "notnull": true } + }, + { + "name": "el_index", + "type": "blob", + "comment": "In the case of HTTP URLs, this is the URL with any username or password removed, and with the labels in the hostname reversed and converted to lower case which will allow faster searching for all pages with WHERE clause. Note: If PHP's intl extension is enabled/disabled, maintenance/refreshExternallinksIndex.php needs to be run to refresh this field", + "options": { "length": 65530, "notnull": true } + }, + { + "name": "el_index_60", + "type": "binary", + "comment": "'el_index' truncated to 60 bytes to allow for sortable queries that aren't supported by a partial index", + "options": { "notnull": true, "length": 60 } + }, + { + "name": "el_to_domain_index", + "type": "binary", + "comment": "Indexable domain", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "el_to_path", + "type": "blob", + "comment": "Path to the external link without considering the domain", + "options": { "length": 65530, "notnull": false } + } + ], + "indexes": [ + { "name": "el_from", "columns": [ "el_from" ], "unique": false }, + { "name": "el_to", "columns": [ "el_to", "el_from" ], "unique": false, "options": { "lengths": [ 60, null ] } }, + { "name": "el_index", "columns": [ "el_index" ], "unique": false, "options": { "lengths": [ 60 ] } }, + { "name": "el_index_60", "columns": [ "el_index_60", "el_id" ], "unique": false }, + { "name": "el_from_index_60", "columns": [ "el_from", "el_index_60", "el_id" ], "unique": false }, + { "name": "el_to_domain_index_to_path", "columns": [ "el_to_domain_index", "el_to_path" ], "unique": false, "options": { "lengths": [ null, 60 ] } } + ], + "pk": [ "el_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-filearchive-fa_id.json b/sql/abstractSchemaChanges/patch-filearchive-fa_id.json new file mode 100644 index 000000000000..7b3b618273a2 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-filearchive-fa_id.json @@ -0,0 +1,488 @@ +{ + "comment": "Set unsigned true for fa_id in filearchive table", + "before": { + "name": "filearchive", + "comment": "Record of deleted file data", + "columns": [ + { + "name": "fa_id", + "comment": "Unique row id", + "type": "integer", + "options": { + "autoincrement": true, + "notnull": true + } + }, + { + "name": "fa_name", + "comment": "Original base filename; key to image.img_name, page.page_title, etc", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "fa_archive_name", + "comment": "Filename of archived file, if an old revision", + "type": "binary", + "options": { + "notnull": false, + "default": "", + "length": 255 + } + }, + { + "name": "fa_storage_group", + "comment": "Which storage bin (directory tree or object store) the file data is stored in. Should be 'deleted' for files that have been deleted; any other bin is not yet in use.", + "type": "binary", + "options": { + "notnull": false, + "length": 16 + } + }, + { + "name": "fa_storage_key", + "comment": "SHA-1 of the file contents plus extension, used as a key for storage. eg 8f8a562add37052a1848ff7771a2c515db94baa9.jpg. If NULL, the file was missing at deletion time or has been purged from the archival storage.", + "type": "binary", + "options": { + "notnull": false, + "default": "", + "length": 64 + } + }, + { + "name": "fa_deleted_user", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "fa_deleted_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": false, + "length": 14 + } + }, + { + "name": "fa_deleted_reason_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_size", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_width", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_height", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_metadata", + "type": "blob", + "options": { + "notnull": false, + "length": 16777215 + } + }, + { + "name": "fa_bits", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_media_type", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "fa_major_mime", + "type": "mwenum", + "options": { + "notnull": false, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "fa_minor_mime", + "type": "binary", + "options": { + "notnull": false, + "default": "unknown", + "length": 100 + } + }, + { + "name": "fa_description_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_actor", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": false, + "length": 14 + } + }, + { + "name": "fa_deleted", + "comment": "Visibility of deleted revisions, bitfield", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "fa_sha1", + "comment": "sha1 hash of file content", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "fa_name", + "comment": "pick out by image name", + "columns": [ + "fa_name", + "fa_timestamp" + ], + "unique": false + }, + { + "name": "fa_storage_group", + "comment": "pick out dupe files", + "columns": [ + "fa_storage_group", + "fa_storage_key" + ], + "unique": false + }, + { + "name": "fa_deleted_timestamp", + "comment": "sort by deletion time", + "columns": [ + "fa_deleted_timestamp" + ], + "unique": false + }, + { + "name": "fa_actor_timestamp", + "comment": "sort by uploader", + "columns": [ + "fa_actor", + "fa_timestamp" + ], + "unique": false + }, + { + "name": "fa_sha1", + "comment": "find file by sha1, 10 bytes will be enough for hashes to be indexed", + "columns": [ + "fa_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + } + ], + "pk": [ + "fa_id" + ] + }, + "after": { + "name": "filearchive", + "comment": "Record of deleted file data", + "columns": [ + { + "name": "fa_id", + "comment": "Unique row id", + "type": "integer", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_name", + "comment": "Original base filename; key to image.img_name, page.page_title, etc", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "fa_archive_name", + "comment": "Filename of archived file, if an old revision", + "type": "binary", + "options": { + "notnull": false, + "default": "", + "length": 255 + } + }, + { + "name": "fa_storage_group", + "comment": "Which storage bin (directory tree or object store) the file data is stored in. Should be 'deleted' for files that have been deleted; any other bin is not yet in use.", + "type": "binary", + "options": { + "notnull": false, + "length": 16 + } + }, + { + "name": "fa_storage_key", + "comment": "SHA-1 of the file contents plus extension, used as a key for storage. eg 8f8a562add37052a1848ff7771a2c515db94baa9.jpg. If NULL, the file was missing at deletion time or has been purged from the archival storage.", + "type": "binary", + "options": { + "notnull": false, + "default": "", + "length": 64 + } + }, + { + "name": "fa_deleted_user", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "fa_deleted_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": false, + "length": 14 + } + }, + { + "name": "fa_deleted_reason_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_size", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_width", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_height", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_metadata", + "type": "blob", + "options": { + "notnull": false, + "length": 16777215 + } + }, + { + "name": "fa_bits", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_media_type", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "fa_major_mime", + "type": "mwenum", + "options": { + "notnull": false, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "fa_minor_mime", + "type": "binary", + "options": { + "notnull": false, + "default": "unknown", + "length": 100 + } + }, + { + "name": "fa_description_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_actor", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": false, + "length": 14 + } + }, + { + "name": "fa_deleted", + "comment": "Visibility of deleted revisions, bitfield", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "fa_sha1", + "comment": "sha1 hash of file content", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "fa_name", + "comment": "pick out by image name", + "columns": [ + "fa_name", + "fa_timestamp" + ], + "unique": false + }, + { + "name": "fa_storage_group", + "comment": "pick out dupe files", + "columns": [ + "fa_storage_group", + "fa_storage_key" + ], + "unique": false + }, + { + "name": "fa_deleted_timestamp", + "comment": "sort by deletion time", + "columns": [ + "fa_deleted_timestamp" + ], + "unique": false + }, + { + "name": "fa_actor_timestamp", + "comment": "sort by uploader", + "columns": [ + "fa_actor", + "fa_timestamp" + ], + "unique": false + }, + { + "name": "fa_sha1", + "comment": "find file by sha1, 10 bytes will be enough for hashes to be indexed", + "columns": [ + "fa_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + } + ], + "pk": [ + "fa_id" + ] + } +} diff --git a/sql/abstractSchemaChanges/patch-filearchive-fa_size_to_bigint.json b/sql/abstractSchemaChanges/patch-filearchive-fa_size_to_bigint.json new file mode 100644 index 000000000000..7226c09e9bfc --- /dev/null +++ b/sql/abstractSchemaChanges/patch-filearchive-fa_size_to_bigint.json @@ -0,0 +1,487 @@ +{ + "comment": "Increase fa_size to bigint (T191805)", + "before": + { + "name": "filearchive", + "comment": "Record of deleted file data", + "columns": [ + { + "name": "fa_id", + "comment": "Unique row id", + "type": "integer", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_name", + "comment": "Original base filename; key to image.img_name, page.page_title, etc", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "fa_archive_name", + "comment": "Filename of archived file, if an old revision", + "type": "binary", + "options": { + "notnull": false, + "default": "", + "length": 255 + } + }, + { + "name": "fa_storage_group", + "comment": "Which storage bin (directory tree or object store) the file data is stored in. Should be 'deleted' for files that have been deleted; any other bin is not yet in use.", + "type": "binary", + "options": { + "notnull": false, + "length": 16 + } + }, + { + "name": "fa_storage_key", + "comment": "SHA-1 of the file contents plus extension, used as a key for storage. eg 8f8a562add37052a1848ff7771a2c515db94baa9.jpg. If NULL, the file was missing at deletion time or has been purged from the archival storage.", + "type": "binary", + "options": { + "notnull": false, + "default": "", + "length": 64 + } + }, + { + "name": "fa_deleted_user", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "fa_deleted_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": false + } + }, + { + "name": "fa_deleted_reason_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_size", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_width", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_height", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_metadata", + "type": "blob", + "options": { + "notnull": false, + "length": 16777215 + } + }, + { + "name": "fa_bits", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_media_type", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "fa_major_mime", + "type": "mwenum", + "options": { + "notnull": false, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "fa_minor_mime", + "type": "binary", + "options": { + "notnull": false, + "default": "unknown", + "length": 100 + } + }, + { + "name": "fa_description_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_actor", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": false + } + }, + { + "name": "fa_deleted", + "comment": "Visibility of deleted revisions, bitfield", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "fa_sha1", + "comment": "sha1 hash of file content", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "fa_name", + "comment": "pick out by image name", + "columns": [ + "fa_name", + "fa_timestamp" + ], + "unique": false + }, + { + "name": "fa_storage_group", + "comment": "pick out dupe files", + "columns": [ + "fa_storage_group", + "fa_storage_key" + ], + "unique": false + }, + { + "name": "fa_deleted_timestamp", + "comment": "sort by deletion time", + "columns": [ + "fa_deleted_timestamp" + ], + "unique": false + }, + { + "name": "fa_actor_timestamp", + "comment": "sort by uploader", + "columns": [ + "fa_actor", + "fa_timestamp" + ], + "unique": false + }, + { + "name": "fa_sha1", + "comment": "find file by sha1, 10 bytes will be enough for hashes to be indexed", + "columns": [ + "fa_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + } + ], + "pk": [ + "fa_id" + ] + }, + "after": + { + "name": "filearchive", + "comment": "Record of deleted file data", + "columns": [ + { + "name": "fa_id", + "comment": "Unique row id", + "type": "integer", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_name", + "comment": "Original base filename; key to image.img_name, page.page_title, etc", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "fa_archive_name", + "comment": "Filename of archived file, if an old revision", + "type": "binary", + "options": { + "notnull": false, + "default": "", + "length": 255 + } + }, + { + "name": "fa_storage_group", + "comment": "Which storage bin (directory tree or object store) the file data is stored in. Should be 'deleted' for files that have been deleted; any other bin is not yet in use.", + "type": "binary", + "options": { + "notnull": false, + "length": 16 + } + }, + { + "name": "fa_storage_key", + "comment": "SHA-1 of the file contents plus extension, used as a key for storage. eg 8f8a562add37052a1848ff7771a2c515db94baa9.jpg. If NULL, the file was missing at deletion time or has been purged from the archival storage.", + "type": "binary", + "options": { + "notnull": false, + "default": "", + "length": 64 + } + }, + { + "name": "fa_deleted_user", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "fa_deleted_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": false + } + }, + { + "name": "fa_deleted_reason_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_size", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_width", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_height", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_metadata", + "type": "blob", + "options": { + "notnull": false, + "length": 16777215 + } + }, + { + "name": "fa_bits", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_media_type", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "fa_major_mime", + "type": "mwenum", + "options": { + "notnull": false, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "fa_minor_mime", + "type": "binary", + "options": { + "notnull": false, + "default": "unknown", + "length": 100 + } + }, + { + "name": "fa_description_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_actor", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": false + } + }, + { + "name": "fa_deleted", + "comment": "Visibility of deleted revisions, bitfield", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "fa_sha1", + "comment": "sha1 hash of file content", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "fa_name", + "comment": "pick out by image name", + "columns": [ + "fa_name", + "fa_timestamp" + ], + "unique": false + }, + { + "name": "fa_storage_group", + "comment": "pick out dupe files", + "columns": [ + "fa_storage_group", + "fa_storage_key" + ], + "unique": false + }, + { + "name": "fa_deleted_timestamp", + "comment": "sort by deletion time", + "columns": [ + "fa_deleted_timestamp" + ], + "unique": false + }, + { + "name": "fa_actor_timestamp", + "comment": "sort by uploader", + "columns": [ + "fa_actor", + "fa_timestamp" + ], + "unique": false + }, + { + "name": "fa_sha1", + "comment": "find file by sha1, 10 bytes will be enough for hashes to be indexed", + "columns": [ + "fa_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + } + ], + "pk": [ + "fa_id" + ] + } +} diff --git a/sql/abstractSchemaChanges/patch-image-img_size_to_bigint.json b/sql/abstractSchemaChanges/patch-image-img_size_to_bigint.json new file mode 100644 index 000000000000..b86976409173 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-image-img_size_to_bigint.json @@ -0,0 +1,368 @@ +{ + "comment": "Make img.img_size an unsigned bigint (T191805)", + "before": + { + "name": "image", + "comment": "Uploaded images and other files.", + "columns": [ + { + "name": "img_name", + "comment": "Filename. This is also the title of the associated description page, which will be in namespace 6 (NS_FILE).", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "img_size", + "comment": "File size in bytes.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "img_width", + "comment": "For images, width in pixels.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "img_height", + "comment": "For images, height in pixels.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "img_metadata", + "comment": "Extracted Exif metadata stored as a json array (new system) or serialized PHP array (old system). The json array can contain an address in the text table or external storage.", + "type": "blob", + "options": { + "notnull": true, + "length": 16777215 + } + }, + { + "name": "img_bits", + "comment": "For images, bits per pixel if known.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "img_media_type", + "comment": "Media type as defined by the MEDIATYPE_xxx constants", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "img_major_mime", + "comment": "major part of a MIME media type as defined by IANA see https://www.iana.org/assignments/media-types/ for \"chemical\" cf. http://dx.doi.org/10.1021/ci9803233 by the ACS", + "type": "mwenum", + "options": { + "notnull": true, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "img_minor_mime", + "comment": "minor part of a MIME media type as defined by IANA the minor parts are not required to adhere to any standard but should be consistent throughout the database see https://www.iana.org/assignments/media-types/", + "type": "binary", + "options": { + "notnull": true, + "default": "unknown", + "length": 100 + } + }, + { + "name": "img_description_id", + "comment": "Foreign key to comment table, which contains the description field as entered by the uploader. This is displayed in image upload history and logs.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "img_actor", + "comment": "actor_id of the uploader.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "img_timestamp", + "comment": "Time of the upload.", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "img_sha1", + "comment": "SHA-1 content hash in base-36", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "img_actor_timestamp", + "comment": "Used by Special:Newimages and ApiQueryAllImages", + "columns": [ + "img_actor", + "img_timestamp" + ], + "unique": false + }, + { + "name": "img_size", + "comment": "Used by Special:ListFiles for sort-by-size", + "columns": [ + "img_size" + ], + "unique": false + }, + { + "name": "img_timestamp", + "comment": "Used by Special:Newimages and Special:ListFiles", + "columns": [ + "img_timestamp" + ], + "unique": false + }, + { + "name": "img_sha1", + "comment": "Used in API and duplicate search", + "columns": [ + "img_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + }, + { + "name": "img_media_mime", + "comment": "Used to get media of one type", + "columns": [ + "img_media_type", + "img_major_mime", + "img_minor_mime" + ], + "unique": false + } + ], + "pk": [ + "img_name" + ] + }, + "after": + { + "name": "image", + "comment": "Uploaded images and other files.", + "columns": [ + { + "name": "img_name", + "comment": "Filename. This is also the title of the associated description page, which will be in namespace 6 (NS_FILE).", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "img_size", + "comment": "File size in bytes.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "img_width", + "comment": "For images, width in pixels.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "img_height", + "comment": "For images, height in pixels.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "img_metadata", + "comment": "Extracted Exif metadata stored as a json array (new system) or serialized PHP array (old system). The json array can contain an address in the text table or external storage.", + "type": "blob", + "options": { + "notnull": true, + "length": 16777215 + } + }, + { + "name": "img_bits", + "comment": "For images, bits per pixel if known.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "img_media_type", + "comment": "Media type as defined by the MEDIATYPE_xxx constants", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "img_major_mime", + "comment": "major part of a MIME media type as defined by IANA see https://www.iana.org/assignments/media-types/ for \"chemical\" cf. http://dx.doi.org/10.1021/ci9803233 by the ACS", + "type": "mwenum", + "options": { + "notnull": true, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "img_minor_mime", + "comment": "minor part of a MIME media type as defined by IANA the minor parts are not required to adhere to any standard but should be consistent throughout the database see https://www.iana.org/assignments/media-types/", + "type": "binary", + "options": { + "notnull": true, + "default": "unknown", + "length": 100 + } + }, + { + "name": "img_description_id", + "comment": "Foreign key to comment table, which contains the description field as entered by the uploader. This is displayed in image upload history and logs.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "img_actor", + "comment": "actor_id of the uploader.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "img_timestamp", + "comment": "Time of the upload.", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "img_sha1", + "comment": "SHA-1 content hash in base-36", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "img_actor_timestamp", + "comment": "Used by Special:Newimages and ApiQueryAllImages", + "columns": [ + "img_actor", + "img_timestamp" + ], + "unique": false + }, + { + "name": "img_size", + "comment": "Used by Special:ListFiles for sort-by-size", + "columns": [ + "img_size" + ], + "unique": false + }, + { + "name": "img_timestamp", + "comment": "Used by Special:Newimages and Special:ListFiles", + "columns": [ + "img_timestamp" + ], + "unique": false + }, + { + "name": "img_sha1", + "comment": "Used in API and duplicate search", + "columns": [ + "img_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + }, + { + "name": "img_media_mime", + "comment": "Used to get media of one type", + "columns": [ + "img_media_type", + "img_major_mime", + "img_minor_mime" + ], + "unique": false + } + ], + "pk": [ + "img_name" + ] + } + +} diff --git a/sql/abstractSchemaChanges/patch-ipblocks-ipb_id.json b/sql/abstractSchemaChanges/patch-ipblocks-ipb_id.json new file mode 100644 index 000000000000..b5fdde258ceb --- /dev/null +++ b/sql/abstractSchemaChanges/patch-ipblocks-ipb_id.json @@ -0,0 +1,477 @@ +{ + "comment": "Set unsigned true for ipb_id and ipb_parent_block_id in ipblocks table", + "before": { + "name": "ipblocks", + "comment": "Blocks against user accounts, IP addresses and IP ranges.", + "columns": [ + { + "name": "ipb_id", + "comment": "Primary key, introduced for privacy.", + "type": "integer", + "options": { + "autoincrement": true, + "notnull": true + } + }, + { + "name": "ipb_address", + "comment": "Blocked IP address in dotted-quad form or user name.", + "type": "blob", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "ipb_user", + "comment": "Blocked user ID or 0 for IP blocks.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "ipb_by_actor", + "comment": "Actor who made the block.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "ipb_reason_id", + "comment": "Key to comment_id. Text comment made by blocker.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "ipb_timestamp", + "comment": "Creation (or refresh) date in standard YMDHMS form. IP blocks expire automatically.", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "ipb_auto", + "comment": "Indicates that the IP address was banned because a banned user accessed a page through it. If this is 1, ipb_address will be hidden, and the block identified by block ID number.", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "ipb_anon_only", + "comment": "If set to 1, block applies only to logged-out users", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "ipb_create_account", + "comment": "Block prevents account creation from matching IP addresses", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 1 + } + }, + { + "name": "ipb_enable_autoblock", + "comment": "Block triggers autoblocks", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 1 + } + }, + { + "name": "ipb_expiry", + "comment": "Time at which the block will expire. May be \"infinity\"", + "type": "mwtimestamp", + "options": { + "notnull": true, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + }, + { + "name": "ipb_range_start", + "comment": "Start of an address range, in hexadecimal size chosen to allow IPv6. FIXME: this field were originally blank for single-IP blocks, but now it's populated. No migration was ever done. It should be fixed to be blank again for such blocks (T51504).", + "type": "blob", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "ipb_range_end", + "comment": "End of an address range, in hexadecimal size chosen to allow IPv6. FIXME: this field were originally blank for single-IP blocks, but now it's populated. No migration was ever done. It should be fixed to be blank again for such blocks (T51504).", + "type": "blob", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "ipb_deleted", + "comment": "Flag for entries hidden from users and Sysops", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "ipb_block_email", + "comment": "Block prevents user from accessing Special:Emailuser", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "ipb_allow_usertalk", + "comment": "Block allows user to edit their own talk page", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "ipb_parent_block_id", + "comment": "ID of the block that caused this block to exist. Autoblocks set this to the original block so that the original block being deleted also deletes the autoblocks", + "type": "integer", + "options": { + "notnull": false, + "default": null + } + }, + { + "name": "ipb_sitewide", + "comment": "Block user from editing any page on the site (other than their own user talk page).", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 1 + } + } + ], + "indexes": [ + { + "name": "ipb_address_unique", + "comment": "Unique index to support \"user already blocked\" messages. Any new options which prevent collisions should be included", + "columns": [ + "ipb_address", + "ipb_user", + "ipb_auto" + ], + "unique": true, + "options": { "lengths": [ 255, null, null ] } + }, + { + "name": "ipb_user", + "comment": "For querying whether a logged-in user is blocked", + "columns": [ + "ipb_user" + ], + "unique": false + }, + { + "name": "ipb_range", + "comment": "For querying whether an IP address is in any range", + "columns": [ + "ipb_range_start", + "ipb_range_end" + ], + "unique": false, + "options": { "lengths": [ 8, 8 ] } + }, + { + "name": "ipb_timestamp", + "comment": "Index for Special:BlockList", + "columns": [ + "ipb_timestamp" + ], + "unique": false + }, + { + "name": "ipb_expiry", + "comment": "Index for table pruning", + "columns": [ + "ipb_expiry" + ], + "unique": false + }, + { + "name": "ipb_parent_block_id", + "comment": "Index for removing autoblocks when a parent block is removed", + "columns": [ + "ipb_parent_block_id" + ], + "unique": false + } + ], + "pk": [ + "ipb_id" + ] + }, + "after": { + "name": "ipblocks", + "comment": "Blocks against user accounts, IP addresses and IP ranges.", + "columns": [ + { + "name": "ipb_id", + "comment": "Primary key, introduced for privacy.", + "type": "integer", + "options": { + "autoincrement": true, + "notnull": true, + "unsigned": true + } + }, + { + "name": "ipb_address", + "comment": "Blocked IP address in dotted-quad form or user name.", + "type": "blob", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "ipb_user", + "comment": "Blocked user ID or 0 for IP blocks.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "ipb_by_actor", + "comment": "Actor who made the block.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "ipb_reason_id", + "comment": "Key to comment_id. Text comment made by blocker.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "ipb_timestamp", + "comment": "Creation (or refresh) date in standard YMDHMS form. IP blocks expire automatically.", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "ipb_auto", + "comment": "Indicates that the IP address was banned because a banned user accessed a page through it. If this is 1, ipb_address will be hidden, and the block identified by block ID number.", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "ipb_anon_only", + "comment": "If set to 1, block applies only to logged-out users", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "ipb_create_account", + "comment": "Block prevents account creation from matching IP addresses", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 1 + } + }, + { + "name": "ipb_enable_autoblock", + "comment": "Block triggers autoblocks", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 1 + } + }, + { + "name": "ipb_expiry", + "comment": "Time at which the block will expire. May be \"infinity\"", + "type": "mwtimestamp", + "options": { + "notnull": true, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + }, + { + "name": "ipb_range_start", + "comment": "Start of an address range, in hexadecimal size chosen to allow IPv6. FIXME: this field were originally blank for single-IP blocks, but now it's populated. No migration was ever done. It should be fixed to be blank again for such blocks (T51504).", + "type": "blob", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "ipb_range_end", + "comment": "End of an address range, in hexadecimal size chosen to allow IPv6. FIXME: this field were originally blank for single-IP blocks, but now it's populated. No migration was ever done. It should be fixed to be blank again for such blocks (T51504).", + "type": "blob", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "ipb_deleted", + "comment": "Flag for entries hidden from users and Sysops", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "ipb_block_email", + "comment": "Block prevents user from accessing Special:Emailuser", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "ipb_allow_usertalk", + "comment": "Block allows user to edit their own talk page", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "ipb_parent_block_id", + "comment": "ID of the block that caused this block to exist. Autoblocks set this to the original block so that the original block being deleted also deletes the autoblocks", + "type": "integer", + "options": { + "notnull": false, + "unsigned": true, + "default": null + } + }, + { + "name": "ipb_sitewide", + "comment": "Block user from editing any page on the site (other than their own user talk page).", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 1 + } + } + ], + "indexes": [ + { + "name": "ipb_address_unique", + "comment": "Unique index to support \"user already blocked\" messages. Any new options which prevent collisions should be included", + "columns": [ + "ipb_address", + "ipb_user", + "ipb_auto" + ], + "unique": true, + "options": { "lengths": [ 255, null, null ] } + }, + { + "name": "ipb_user", + "comment": "For querying whether a logged-in user is blocked", + "columns": [ + "ipb_user" + ], + "unique": false + }, + { + "name": "ipb_range", + "comment": "For querying whether an IP address is in any range", + "columns": [ + "ipb_range_start", + "ipb_range_end" + ], + "unique": false, + "options": { "lengths": [ 8, 8 ] } + }, + { + "name": "ipb_timestamp", + "comment": "Index for Special:BlockList", + "columns": [ + "ipb_timestamp" + ], + "unique": false + }, + { + "name": "ipb_expiry", + "comment": "Index for table pruning", + "columns": [ + "ipb_expiry" + ], + "unique": false + }, + { + "name": "ipb_parent_block_id", + "comment": "Index for removing autoblocks when a parent block is removed", + "columns": [ + "ipb_parent_block_id" + ], + "unique": false + } + ], + "pk": [ + "ipb_id" + ] + } +} diff --git a/sql/abstractSchemaChanges/patch-ipblocks_restrictions-ir_ipb_id.json b/sql/abstractSchemaChanges/patch-ipblocks_restrictions-ir_ipb_id.json new file mode 100644 index 000000000000..2cddb8ddd58d --- /dev/null +++ b/sql/abstractSchemaChanges/patch-ipblocks_restrictions-ir_ipb_id.json @@ -0,0 +1,69 @@ +{ + "comment": "Set unsigned true for ir_ipb_id in ipblocks_restrictions table", + "before": { + "name": "ipblocks_restrictions", + "comment": "Partial Block Restrictions", + "columns": [ + { + "name": "ir_ipb_id", + "comment": "The ipb_id from ipblocks", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "ir_type", + "comment": "The restriction type id.", + "type": "mwtinyint", + "options": { "notnull": true, "length": 4 } + }, + { + "name": "ir_value", + "comment": "The restriction id that corresponds to the type. Typically a Page ID or a Namespace ID.", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + } + ], + "indexes": [ + { + "name": "ir_type_value", + "comment": "Index to query restrictions by the page or namespace.", + "columns": [ "ir_type", "ir_value" ], + "unique": false + } + ], + "pk": [ "ir_ipb_id", "ir_type", "ir_value" ] + }, + "after": { + "name": "ipblocks_restrictions", + "comment": "Partial Block Restrictions", + "columns": [ + { + "name": "ir_ipb_id", + "comment": "The ipb_id from ipblocks", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "ir_type", + "comment": "The restriction type id.", + "type": "mwtinyint", + "options": { "notnull": true, "length": 4 } + }, + { + "name": "ir_value", + "comment": "The restriction id that corresponds to the type. Typically a Page ID or a Namespace ID.", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + } + ], + "indexes": [ + { + "name": "ir_type_value", + "comment": "Index to query restrictions by the page or namespace.", + "columns": [ "ir_type", "ir_value" ], + "unique": false + } + ], + "pk": [ "ir_ipb_id", "ir_type", "ir_value" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-ipblocks_restrictions-ir_value.json b/sql/abstractSchemaChanges/patch-ipblocks_restrictions-ir_value.json new file mode 100644 index 000000000000..c1ca1177e9c7 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-ipblocks_restrictions-ir_value.json @@ -0,0 +1,69 @@ +{ + "comment": "Set unsigned true for ir_value in ipblocks_restrictions table", + "before": { + "name": "ipblocks_restrictions", + "comment": "Partial Block Restrictions", + "columns": [ + { + "name": "ir_ipb_id", + "comment": "The ipb_id from ipblocks", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "ir_type", + "comment": "The restriction type id.", + "type": "mwtinyint", + "options": { "notnull": true, "length": 4 } + }, + { + "name": "ir_value", + "comment": "The restriction id that corresponds to the type. Typically a Page ID or a Namespace ID.", + "type": "integer", + "options": { "notnull": true } + } + ], + "indexes": [ + { + "name": "ir_type_value", + "comment": "Index to query restrictions by the page or namespace.", + "columns": [ "ir_type", "ir_value" ], + "unique": false + } + ], + "pk": [ "ir_ipb_id", "ir_type", "ir_value" ] + }, + "after": { + "name": "ipblocks_restrictions", + "comment": "Partial Block Restrictions", + "columns": [ + { + "name": "ir_ipb_id", + "comment": "The ipb_id from ipblocks", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "ir_type", + "comment": "The restriction type id.", + "type": "mwtinyint", + "options": { "notnull": true, "length": 4 } + }, + { + "name": "ir_value", + "comment": "The restriction id that corresponds to the type. Typically a Page ID or a Namespace ID.", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + } + ], + "indexes": [ + { + "name": "ir_type_value", + "comment": "Index to query restrictions by the page or namespace.", + "columns": [ "ir_type", "ir_value" ], + "unique": false + } + ], + "pk": [ "ir_ipb_id", "ir_type", "ir_value" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-iwlinks-drop-iwl_prefix_from_title.json b/sql/abstractSchemaChanges/patch-iwlinks-drop-iwl_prefix_from_title.json new file mode 100644 index 000000000000..170f77bbae48 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-iwlinks-drop-iwl_prefix_from_title.json @@ -0,0 +1,75 @@ +{ + "comment": "Drop iwl_title field from iwl_prefix_from_title index", + "before": { + "name": "iwlinks", + "comment": "Track inline interwiki links", + "columns": [ + { + "name": "iwl_from", + "comment": "page_id of the referring page", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "iwl_prefix", + "type": "binary", + "comment": "Interwiki prefix code of the target", + "options": { "notnull": true, "length": 32, "default": "" } + }, + { + "name": "iwl_title", + "type": "binary", + "comment": "Title of the target, including namespace", + "options": { "notnull": true, "length": 255, "default": "" } + } + ], + "indexes": [ + { + "name": "iwl_prefix_title_from", + "columns": [ "iwl_prefix", "iwl_title", "iwl_from" ], + "comment": "Index for ApiQueryIWBacklinks", + "unique": false + }, + { + "name": "iwl_prefix_from_title", + "columns": [ "iwl_prefix", "iwl_from", "iwl_title" ], + "comment": "Index for ApiQueryIWLinks", + "unique": false + } + ], + "pk": [ "iwl_from", "iwl_prefix", "iwl_title" ] + }, + "after": { + "name": "iwlinks", + "comment": "Track inline interwiki links", + "columns": [ + { + "name": "iwl_from", + "comment": "page_id of the referring page", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "iwl_prefix", + "type": "binary", + "comment": "Interwiki prefix code of the target", + "options": { "notnull": true, "length": 32, "default": "" } + }, + { + "name": "iwl_title", + "type": "binary", + "comment": "Title of the target, including namespace", + "options": { "notnull": true, "length": 255, "default": "" } + } + ], + "indexes": [ + { + "name": "iwl_prefix_title_from", + "columns": [ "iwl_prefix", "iwl_title", "iwl_from" ], + "comment": "Index for ApiQueryIWBacklinks", + "unique": false + } + ], + "pk": [ "iwl_from", "iwl_prefix", "iwl_title" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-logging-rename-indexes.json b/sql/abstractSchemaChanges/patch-logging-rename-indexes.json new file mode 100644 index 000000000000..03b96edd467d --- /dev/null +++ b/sql/abstractSchemaChanges/patch-logging-rename-indexes.json @@ -0,0 +1,231 @@ +{ + "comment": "Rename several indexes in logging table to comply with database convention by having log_ prefix", + "before": { + "name": "logging", + "columns": [ + { + "name": "log_id", + "comment": "Log ID, for referring to this specific log entry, probably for deletion and such.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "log_type", + "comment": "Symbolic key for the general log type. The output format will be controlled by the log_action field.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32 } + }, + { + "name": "log_action", + "comment": "Symbolic key for the log action type.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32 } + }, + { + "name": "log_timestamp", + "type": "mwtimestamp", + "options": { "notnull": true, "default": "19700101000000" } + }, + { + "name": "log_actor", + "type": "bigint", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "log_namespace", + "comment": "Key to the namespace of the page affected", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "log_title", + "comment": "Key to the title of the page affected", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 255 } + }, + { + "name": "log_page", + "comment": "Key to the page affected", + "type": "integer", + "options": { "notnull": false, "unsigned": true } + }, + { + "name": "log_comment_id", + "comment": "Key to comment_id. Comment summarizing the change.", + "type": "bigint", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "log_params", + "comment": "LF separated list (old system) or serialized PHP array (new system)", + "type": "blob", + "options": { "notnull": true, "length": 65530 } + }, + { + "name": "log_deleted", + "comment": "rev_deleted for logs", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + } + ], + "indexes": [ + { + "name": "type_time", + "comment": "Special:Log type filter", + "columns": [ "log_type", "log_timestamp" ], + "unique": false + }, + { + "name": "actor_time", + "comment": "Special:Log performer filter", + "columns": [ "log_actor", "log_timestamp" ], + "unique": false + }, + { + "name": "page_time", + "comment": "Special:Log title filter, log extract", + "columns": [ "log_namespace", "log_title", "log_timestamp" ], + "unique": false + }, + { + "name": "times", + "comment": "Special:Log unfiltered", + "columns": [ "log_timestamp" ], + "unique": false + }, + { + "name": "log_actor_type_time", + "comment": "Special:Log filter by performer and type", + "columns": [ "log_actor", "log_type", "log_timestamp" ], + "unique": false + }, + { + "name": "log_page_id_time", + "comment": "Apparently just used for a few maintenance pages (findMissingFiles.php, Flow). Could be removed?", + "columns": [ "log_page", "log_timestamp" ], + "unique": false + }, + { + "name": "log_type_action", + "comment": "Special:Log action filter", + "columns": [ "log_type", "log_action", "log_timestamp" ], + "unique": false + } + ], + "pk": [ "log_id" ] + }, + "after": { + "name": "logging", + "columns": [ + { + "name": "log_id", + "comment": "Log ID, for referring to this specific log entry, probably for deletion and such.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "log_type", + "comment": "Symbolic key for the general log type. The output format will be controlled by the log_action field.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32 } + }, + { + "name": "log_action", + "comment": "Symbolic key for the log action type.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32 } + }, + { + "name": "log_timestamp", + "type": "mwtimestamp", + "options": { "notnull": true, "default": "19700101000000" } + }, + { + "name": "log_actor", + "type": "bigint", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "log_namespace", + "comment": "Key to the namespace of the page affected", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "log_title", + "comment": "Key to the title of the page affected", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 255 } + }, + { + "name": "log_page", + "comment": "Key to the page affected", + "type": "integer", + "options": { "notnull": false, "unsigned": true } + }, + { + "name": "log_comment_id", + "comment": "Key to comment_id. Comment summarizing the change.", + "type": "bigint", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "log_params", + "comment": "LF separated list (old system) or serialized PHP array (new system)", + "type": "blob", + "options": { "notnull": true, "length": 65530 } + }, + { + "name": "log_deleted", + "comment": "rev_deleted for logs", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + } + ], + "indexes": [ + { + "name": "log_type_time", + "comment": "Special:Log type filter", + "columns": [ "log_type", "log_timestamp" ], + "unique": false + }, + { + "name": "log_actor_time", + "comment": "Special:Log performer filter", + "columns": [ "log_actor", "log_timestamp" ], + "unique": false + }, + { + "name": "log_page_time", + "comment": "Special:Log title filter, log extract", + "columns": [ "log_namespace", "log_title", "log_timestamp" ], + "unique": false + }, + { + "name": "log_times", + "comment": "Special:Log unfiltered", + "columns": [ "log_timestamp" ], + "unique": false + }, + { + "name": "log_actor_type_time", + "comment": "Special:Log filter by performer and type", + "columns": [ "log_actor", "log_type", "log_timestamp" ], + "unique": false + }, + { + "name": "log_page_id_time", + "comment": "Apparently just used for a few maintenance pages (findMissingFiles.php, Flow). Could be removed?", + "columns": [ "log_page", "log_timestamp" ], + "unique": false + }, + { + "name": "log_type_action", + "comment": "Special:Log action filter", + "columns": [ "log_type", "log_action", "log_timestamp" ], + "unique": false + } + ], + "pk": [ "log_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-objectcache-modtoken.json b/sql/abstractSchemaChanges/patch-objectcache-modtoken.json new file mode 100644 index 000000000000..8cb587cc603c --- /dev/null +++ b/sql/abstractSchemaChanges/patch-objectcache-modtoken.json @@ -0,0 +1,63 @@ +{ + "comment": "Add objectcache.modtime and objectcache.token fields (T274174)", + "before": { + "name": "objectcache", + "comment": "For a few generic cache operations if not using Memcached", + "columns": [ + { + "name": "keyname", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 255 } + }, + { + "name": "value", + "type": "blob", + "options": { "notnull": false, "length": 16777215 } + }, + { + "name": "exptime", + "type": "mwtimestamp", + "options": { "notnull": true } + } + ], + "indexes": [ + { "name": "exptime", "columns": [ "exptime" ], "unique": false } + ], + "pk": [ "keyname" ] + }, + "after": { + "name": "objectcache", + "comment": "For a few generic cache operations if not using Memcached", + "columns": [ + { + "name": "keyname", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 255 } + }, + { + "name": "value", + "type": "blob", + "options": { "notnull": false, "length": 16777215 } + }, + { + "name": "exptime", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "modtoken", + "type": "string", + "options": { "notnull": true, "length": 17, "default": "00000000000000000" } + }, + { + "name": "flags", + "type": "integer", + "options": { "notnull": false, "unsigned": true, "default": null } + } + ], + "indexes": [ + { "name": "exptime", "columns": [ "exptime" ], "unique": false } + ], + "pk": [ "keyname" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-oldimage-oi_size_to_bigint.json b/sql/abstractSchemaChanges/patch-oldimage-oi_size_to_bigint.json new file mode 100644 index 000000000000..e122bc373e36 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-oldimage-oi_size_to_bigint.json @@ -0,0 +1,371 @@ +{ + "comment": "Increase oi_size to be a bigint (T191805)", + "before": + { + "name": "oldimage", + "comment": "Previous revisions of uploaded files. Awkwardly, image rows have to be moved into this table at re-upload time.", + "columns": [ + { + "name": "oi_name", + "comment": "Base filename: key to image.img_name", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "oi_archive_name", + "comment": "Filename of the archived file. This is generally a timestamp and '!' prepended to the base name.", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "oi_size", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_width", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_height", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_bits", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_description_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "oi_actor", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "oi_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "oi_metadata", + "type": "blob", + "options": { + "notnull": true, + "length": 16777215 + } + }, + { + "name": "oi_media_type", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "oi_major_mime", + "type": "mwenum", + "options": { + "notnull": true, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "oi_minor_mime", + "type": "binary", + "options": { + "notnull": true, + "default": "unknown", + "length": 100 + } + }, + { + "name": "oi_deleted", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_sha1", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "oi_actor_timestamp", + "columns": [ + "oi_actor", + "oi_timestamp" + ], + "unique": false + }, + { + "name": "oi_name_timestamp", + "columns": [ + "oi_name", + "oi_timestamp" + ], + "unique": false + }, + { + "name": "oi_name_archive_name", + "comment": "oi_archive_name truncated to 14 to avoid key length overflow", + "columns": [ + "oi_name", + "oi_archive_name" + ], + "unique": false, + "options": { "lengths": [ null, 14 ] } + }, + { + "name": "oi_sha1", + "columns": [ + "oi_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + }, + { + "name": "oi_timestamp", + "comment": "Used by Special:ListFiles", + "columns": [ + "oi_timestamp" + ], + "unique": false + } + ] + }, + "after": + { + "name": "oldimage", + "comment": "Previous revisions of uploaded files. Awkwardly, image rows have to be moved into this table at re-upload time.", + "columns": [ + { + "name": "oi_name", + "comment": "Base filename: key to image.img_name", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "oi_archive_name", + "comment": "Filename of the archived file. This is generally a timestamp and '!' prepended to the base name.", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "oi_size", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_width", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_height", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_bits", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_description_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "oi_actor", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "oi_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "oi_metadata", + "type": "blob", + "options": { + "notnull": true, + "length": 16777215 + } + }, + { + "name": "oi_media_type", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "oi_major_mime", + "type": "mwenum", + "options": { + "notnull": true, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "oi_minor_mime", + "type": "binary", + "options": { + "notnull": true, + "default": "unknown", + "length": 100 + } + }, + { + "name": "oi_deleted", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_sha1", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "oi_actor_timestamp", + "columns": [ + "oi_actor", + "oi_timestamp" + ], + "unique": false + }, + { + "name": "oi_name_timestamp", + "columns": [ + "oi_name", + "oi_timestamp" + ], + "unique": false + }, + { + "name": "oi_name_archive_name", + "comment": "oi_archive_name truncated to 14 to avoid key length overflow", + "columns": [ + "oi_name", + "oi_archive_name" + ], + "unique": false, + "options": { "lengths": [ null, 14 ] } + }, + { + "name": "oi_sha1", + "columns": [ + "oi_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + }, + { + "name": "oi_timestamp", + "comment": "Used by Special:ListFiles", + "columns": [ + "oi_timestamp" + ], + "unique": false + } + ] + } +} diff --git a/sql/abstractSchemaChanges/patch-oldimage-oi_timestamp.json b/sql/abstractSchemaChanges/patch-oldimage-oi_timestamp.json new file mode 100644 index 000000000000..32ee34ae43e2 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-oldimage-oi_timestamp.json @@ -0,0 +1,363 @@ +{ + "comment": "Add index on oi_timestamp (T279982)", + "before": { + "name": "oldimage", + "comment": "Previous revisions of uploaded files. Awkwardly, image rows have to be moved into this table at re-upload time.", + "columns": [ + { + "name": "oi_name", + "comment": "Base filename: key to image.img_name", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "oi_archive_name", + "comment": "Filename of the archived file. This is generally a timestamp and '!' prepended to the base name.", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "oi_size", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_width", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_height", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_bits", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_description_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "oi_actor", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "oi_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": true, + "length": 14 + } + }, + { + "name": "oi_metadata", + "type": "blob", + "options": { + "notnull": true, + "length": 16777215 + } + }, + { + "name": "oi_media_type", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "oi_major_mime", + "type": "mwenum", + "options": { + "notnull": true, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "oi_minor_mime", + "type": "binary", + "options": { + "notnull": true, + "default": "unknown", + "length": 100 + } + }, + { + "name": "oi_deleted", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_sha1", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "oi_actor_timestamp", + "columns": [ + "oi_actor", + "oi_timestamp" + ], + "unique": false + }, + { + "name": "oi_name_timestamp", + "columns": [ + "oi_name", + "oi_timestamp" + ], + "unique": false + }, + { + "name": "oi_name_archive_name", + "comment": "oi_archive_name truncated to 14 to avoid key length overflow", + "columns": [ + "oi_name", + "oi_archive_name" + ], + "unique": false, + "options": { "lengths": [ null, 14 ] } + }, + { + "name": "oi_sha1", + "columns": [ + "oi_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + } + ] + }, + "after": { + "name": "oldimage", + "comment": "Previous revisions of uploaded files. Awkwardly, image rows have to be moved into this table at re-upload time.", + "columns": [ + { + "name": "oi_name", + "comment": "Base filename: key to image.img_name", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "oi_archive_name", + "comment": "Filename of the archived file. This is generally a timestamp and '!' prepended to the base name.", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "oi_size", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_width", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_height", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_bits", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_description_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "oi_actor", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "oi_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": true, + "length": 14 + } + }, + { + "name": "oi_metadata", + "type": "blob", + "options": { + "notnull": true, + "length": 16777215 + } + }, + { + "name": "oi_media_type", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "oi_major_mime", + "type": "mwenum", + "options": { + "notnull": true, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "oi_minor_mime", + "type": "binary", + "options": { + "notnull": true, + "default": "unknown", + "length": 100 + } + }, + { + "name": "oi_deleted", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_sha1", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "oi_actor_timestamp", + "columns": [ + "oi_actor", + "oi_timestamp" + ], + "unique": false + }, + { + "name": "oi_name_timestamp", + "columns": [ + "oi_name", + "oi_timestamp" + ], + "unique": false + }, + { + "name": "oi_name_archive_name", + "comment": "oi_archive_name truncated to 14 to avoid key length overflow", + "columns": [ + "oi_name", + "oi_archive_name" + ], + "unique": false, + "options": { "lengths": [ null, 14 ] } + }, + { + "name": "oi_sha1", + "columns": [ + "oi_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + }, + { + "name": "oi_timestamp", + "comment": "Used by Special:ListFiles", + "columns": [ + "oi_timestamp" + ], + "unique": false + } + ] + } +} diff --git a/sql/abstractSchemaChanges/patch-page-drop-page_restrictions.json b/sql/abstractSchemaChanges/patch-page-drop-page_restrictions.json new file mode 100644 index 000000000000..ee21dc05b194 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-page-drop-page_restrictions.json @@ -0,0 +1,243 @@ +{ + "comment": "Drop legacy page.page_restrictions field (T35334)", + "before": { + "name": "page", + "comment": "Core of the wiki: each page has an entry here which identifies it by title and contains some essential metadata.", + "columns": [ + { + "name": "page_id", + "comment": "Unique identifier number. The page_id will be preserved across edits and rename operations, but not deletions and recreations.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "page_namespace", + "comment": "A page name is broken into a namespace and a title. The namespace keys are UI-language-independent constants, defined in includes/Defines.php", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "page_title", + "comment": "The rest of the title, as text. Spaces are transformed into underscores in title storage.", + "type": "binary", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "page_restrictions", + "comment": "Comma-separated set of permission keys indicating who can move or edit the page.", + "type": "blob", + "options": { "notnull": false, "length": 255 } + }, + { + "name": "page_is_redirect", + "comment": "1 indicates the article is a redirect.", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "page_is_new", + "comment": "1 indicates this is a new entry, with only one edit. Not all pages with one edit are new pages.", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "page_random", + "comment": "Random value between 0 and 1, used for Special:Randompage", + "type": "float", + "options": { + "notnull": true, + "unsigned": true, + "CustomSchemaOptions": { + "doublePrecision": true + } + } + }, + { + "name": "page_touched", + "comment": "This timestamp is updated whenever the page changes in a way requiring it to be re-rendered, invalidating caches. Aside from editing this includes permission changes, creation or deletion of linked pages, and alteration of contained templates.", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "page_links_updated", + "comment": "This timestamp is updated whenever a page is re-parsed and it has all the link tracking tables updated for it. This is useful for de-duplicating expensive backlink update jobs.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + }, + { + "name": "page_latest", + "comment": "Handy key to revision.rev_id of the current revision. This may be 0 during page creation, but that shouldn't happen outside of a transaction... hopefully.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "page_len", + "comment": "Uncompressed length in bytes of the page's current source text.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "page_content_model", + "comment": "content model, see CONTENT_MODEL_XXX constants", + "type": "binary", + "options": { "length": 32, "notnull": false } + }, + { + "name": "page_lang", + "comment": "Page content language", + "type": "binary", + "options": { "length": 35, "notnull": false } + } + ], + "indexes": [ + { + "name": "page_name_title", + "columns": [ "page_namespace", "page_title" ], + "comment": "The title index. Care must be taken to always specify a namespace when by title, so that the index is used. Even listing all known namespaces with IN() is better than omitting page_namespace from the WHERE clause.", + "unique": true + }, + { + "name": "page_random", + "columns": [ "page_random" ], + "comment": "Index for Special:Random", + "unique": false + }, + { + "name": "page_len", + "columns": [ "page_len" ], + "comment": "Questionable utility, used by ProofreadPage, possibly DynamicPageList. ApiQueryAllPages unconditionally filters on namespace and so hopefully does not use it.", + "unique": false + }, + { + "name": "page_redirect_namespace_len", + "columns": [ "page_is_redirect", "page_namespace", "page_len" ], + "comment": "The index for Special:Shortpages and Special:Longpages. Also SiteStats::articles() in 'comma' counting mode, MessageCache::loadFromDB().", + "unique": false + } + ], + "pk": [ "page_id" ] + }, + "after": { + "name": "page", + "comment": "Core of the wiki: each page has an entry here which identifies it by title and contains some essential metadata.", + "columns": [ + { + "name": "page_id", + "comment": "Unique identifier number. The page_id will be preserved across edits and rename operations, but not deletions and recreations.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "page_namespace", + "comment": "A page name is broken into a namespace and a title. The namespace keys are UI-language-independent constants, defined in includes/Defines.php", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "page_title", + "comment": "The rest of the title, as text. Spaces are transformed into underscores in title storage.", + "type": "binary", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "page_is_redirect", + "comment": "1 indicates the article is a redirect.", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "page_is_new", + "comment": "1 indicates this is a new entry, with only one edit. Not all pages with one edit are new pages.", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "page_random", + "comment": "Random value between 0 and 1, used for Special:Randompage", + "type": "float", + "options": { + "notnull": true, + "unsigned": true, + "CustomSchemaOptions": { + "doublePrecision": true + } + } + }, + { + "name": "page_touched", + "comment": "This timestamp is updated whenever the page changes in a way requiring it to be re-rendered, invalidating caches. Aside from editing this includes permission changes, creation or deletion of linked pages, and alteration of contained templates.", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "page_links_updated", + "comment": "This timestamp is updated whenever a page is re-parsed and it has all the link tracking tables updated for it. This is useful for de-duplicating expensive backlink update jobs.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + }, + { + "name": "page_latest", + "comment": "Handy key to revision.rev_id of the current revision. This may be 0 during page creation, but that shouldn't happen outside of a transaction... hopefully.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "page_len", + "comment": "Uncompressed length in bytes of the page's current source text.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "page_content_model", + "comment": "content model, see CONTENT_MODEL_XXX constants", + "type": "binary", + "options": { "length": 32, "notnull": false } + }, + { + "name": "page_lang", + "comment": "Page content language", + "type": "binary", + "options": { "length": 35, "notnull": false } + } + ], + "indexes": [ + { + "name": "page_name_title", + "columns": [ "page_namespace", "page_title" ], + "comment": "The title index. Care must be taken to always specify a namespace when by title, so that the index is used. Even listing all known namespaces with IN() is better than omitting page_namespace from the WHERE clause.", + "unique": true + }, + { + "name": "page_random", + "columns": [ "page_random" ], + "comment": "Index for Special:Random", + "unique": false + }, + { + "name": "page_len", + "columns": [ "page_len" ], + "comment": "Questionable utility, used by ProofreadPage, possibly DynamicPageList. ApiQueryAllPages unconditionally filters on namespace and so hopefully does not use it.", + "unique": false + }, + { + "name": "page_redirect_namespace_len", + "columns": [ "page_is_redirect", "page_namespace", "page_len" ], + "comment": "The index for Special:Shortpages and Special:Longpages. Also SiteStats::articles() in 'comma' counting mode, MessageCache::loadFromDB().", + "unique": false + } + ], + "pk": [ "page_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-page-page_links_updated-noinfinite.json b/sql/abstractSchemaChanges/patch-page-page_links_updated-noinfinite.json new file mode 100644 index 000000000000..e716c63a77a6 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-page-page_links_updated-noinfinite.json @@ -0,0 +1,234 @@ +{ + "comment": "Remove allowInfinite from page_links_updated (T298317)", + "before": { + "name": "page", + "comment": "Core of the wiki: each page has an entry here which identifies it by title and contains some essential metadata.", + "columns": [ + { + "name": "page_id", + "comment": "Unique identifier number. The page_id will be preserved across edits and rename operations, but not deletions and recreations.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "page_namespace", + "comment": "A page name is broken into a namespace and a title. The namespace keys are UI-language-independent constants, defined in includes/Defines.php", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "page_title", + "comment": "The rest of the title, as text. Spaces are transformed into underscores in title storage.", + "type": "binary", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "page_is_redirect", + "comment": "1 indicates the article is a redirect. If so, there is a row in the `redirect` table with rd_from=page_id, which contains the redirect target.", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "page_is_new", + "comment": "1 indicates this is a new entry, with only one edit. Not all pages with one edit are new pages.", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "page_random", + "comment": "Random value between 0 and 1, used for Special:Randompage", + "type": "float", + "options": { + "notnull": true, + "unsigned": true, + "CustomSchemaOptions": { + "doublePrecision": true + } + } + }, + { + "name": "page_touched", + "comment": "This timestamp is updated whenever the page changes in a way requiring it to be re-rendered, invalidating caches. Aside from editing this includes permission changes, creation or deletion of linked pages, and alteration of contained templates.", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "page_links_updated", + "comment": "This timestamp is updated whenever a page is re-parsed and it has all the link tracking tables updated for it. This is useful for de-duplicating expensive backlink update jobs.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + }, + { + "name": "page_latest", + "comment": "Handy key to revision.rev_id of the current revision. This may be 0 during page creation, but that shouldn't happen outside of a transaction... hopefully.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "page_len", + "comment": "Uncompressed length in bytes of the page's current source text.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "page_content_model", + "comment": "content model, see CONTENT_MODEL_XXX constants", + "type": "binary", + "options": { "length": 32, "notnull": false } + }, + { + "name": "page_lang", + "comment": "Page content language", + "type": "binary", + "options": { "length": 35, "notnull": false } + } + ], + "indexes": [ + { + "name": "page_name_title", + "columns": [ "page_namespace", "page_title" ], + "comment": "The title index. Care must be taken to always specify a namespace when by title, so that the index is used. Even listing all known namespaces with IN() is better than omitting page_namespace from the WHERE clause.", + "unique": true + }, + { + "name": "page_random", + "columns": [ "page_random" ], + "comment": "Index for Special:Random", + "unique": false + }, + { + "name": "page_len", + "columns": [ "page_len" ], + "comment": "Questionable utility, used by ProofreadPage, possibly DynamicPageList. ApiQueryAllPages unconditionally filters on namespace and so hopefully does not use it.", + "unique": false + }, + { + "name": "page_redirect_namespace_len", + "columns": [ "page_is_redirect", "page_namespace", "page_len" ], + "comment": "The index for Special:Shortpages and Special:Longpages. Also SiteStats::articles() in 'comma' counting mode, MessageCache::loadFromDB().", + "unique": false + } + ], + "pk": [ "page_id" ] + }, + "after": { + "name": "page", + "comment": "Core of the wiki: each page has an entry here which identifies it by title and contains some essential metadata.", + "columns": [ + { + "name": "page_id", + "comment": "Unique identifier number. The page_id will be preserved across edits and rename operations, but not deletions and recreations.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "page_namespace", + "comment": "A page name is broken into a namespace and a title. The namespace keys are UI-language-independent constants, defined in includes/Defines.php", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "page_title", + "comment": "The rest of the title, as text. Spaces are transformed into underscores in title storage.", + "type": "binary", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "page_is_redirect", + "comment": "1 indicates the article is a redirect. If so, there is a row in the `redirect` table with rd_from=page_id, which contains the redirect target.", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "page_is_new", + "comment": "1 indicates this is a new entry, with only one edit. Not all pages with one edit are new pages.", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "page_random", + "comment": "Random value between 0 and 1, used for Special:Randompage", + "type": "float", + "options": { + "notnull": true, + "unsigned": true, + "CustomSchemaOptions": { + "doublePrecision": true + } + } + }, + { + "name": "page_touched", + "comment": "This timestamp is updated whenever the page changes in a way requiring it to be re-rendered, invalidating caches. Aside from editing this includes permission changes, creation or deletion of linked pages, and alteration of contained templates.", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "page_links_updated", + "comment": "This timestamp is updated whenever a page is re-parsed and it has all the link tracking tables updated for it. This is useful for de-duplicating expensive backlink update jobs.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "default": null + } + }, + { + "name": "page_latest", + "comment": "Handy key to revision.rev_id of the current revision. This may be 0 during page creation, but that shouldn't happen outside of a transaction... hopefully.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "page_len", + "comment": "Uncompressed length in bytes of the page's current source text.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "page_content_model", + "comment": "content model, see CONTENT_MODEL_XXX constants", + "type": "binary", + "options": { "length": 32, "notnull": false } + }, + { + "name": "page_lang", + "comment": "Page content language", + "type": "binary", + "options": { "length": 35, "notnull": false } + } + ], + "indexes": [ + { + "name": "page_name_title", + "columns": [ "page_namespace", "page_title" ], + "comment": "The title index. Care must be taken to always specify a namespace when by title, so that the index is used. Even listing all known namespaces with IN() is better than omitting page_namespace from the WHERE clause.", + "unique": true + }, + { + "name": "page_random", + "columns": [ "page_random" ], + "comment": "Index for Special:Random", + "unique": false + }, + { + "name": "page_len", + "columns": [ "page_len" ], + "comment": "Questionable utility, used by ProofreadPage, possibly DynamicPageList. ApiQueryAllPages unconditionally filters on namespace and so hopefully does not use it.", + "unique": false + }, + { + "name": "page_redirect_namespace_len", + "columns": [ "page_is_redirect", "page_namespace", "page_len" ], + "comment": "The index for Special:Shortpages and Special:Longpages. Also SiteStats::articles() in 'comma' counting mode, MessageCache::loadFromDB().", + "unique": false + } + ], + "pk": [ "page_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-page-rename-name_title-index.json b/sql/abstractSchemaChanges/patch-page-rename-name_title-index.json new file mode 100644 index 000000000000..728548199220 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-page-rename-name_title-index.json @@ -0,0 +1,249 @@ +{ + "comment": "Rename 'name_title' to have the page_ prefix (T270033)", + "before": { + "name": "page", + "comment": "Core of the wiki: each page has an entry here which identifies it by title and contains some essential metadata.", + "columns": [ + { + "name": "page_id", + "comment": "Unique identifier number. The page_id will be preserved across edits and rename operations, but not deletions and recreations.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "page_namespace", + "comment": "A page name is broken into a namespace and a title. The namespace keys are UI-language-independent constants, defined in includes/Defines.php", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "page_title", + "comment": "The rest of the title, as text. Spaces are transformed into underscores in title storage.", + "type": "binary", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "page_restrictions", + "comment": "Comma-separated set of permission keys indicating who can move or edit the page.", + "type": "blob", + "options": { "notnull": false, "length": 255 } + }, + { + "name": "page_is_redirect", + "comment": "1 indicates the article is a redirect.", + "type": "mwtinyint", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "page_is_new", + "comment": "1 indicates this is a new entry, with only one edit. Not all pages with one edit are new pages.", + "type": "mwtinyint", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "page_random", + "comment": "Random value between 0 and 1, used for Special:Randompage", + "type": "float", + "options": { + "notnull": true, + "unsigned": true, + "CustomSchemaOptions": { + "doublePrecision": true + } + } + }, + { + "name": "page_touched", + "comment": "This timestamp is updated whenever the page changes in a way requiring it to be re-rendered, invalidating caches. Aside from editing this includes permission changes, creation or deletion of linked pages, and alteration of contained templates.", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "page_links_updated", + "comment": "This timestamp is updated whenever a page is re-parsed and it has all the link tracking tables updated for it. This is useful for de-duplicating expensive backlink update jobs.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + }, + { + "name": "page_latest", + "comment": "Handy key to revision.rev_id of the current revision. This may be 0 during page creation, but that shouldn't happen outside of a transaction... hopefully.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "page_len", + "comment": "Uncompressed length in bytes of the page's current source text.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "page_content_model", + "comment": "content model, see CONTENT_MODEL_XXX constants", + "type": "binary", + "options": { "length": 32, "notnull": false } + }, + { + "name": "page_lang", + "comment": "Page content language", + "type": "binary", + "options": { "length": 35, "notnull": false } + } + ], + "indexes": [ + { + "name": "name_title", + "columns": [ "page_namespace", "page_title" ], + "comment": "The title index. Care must be taken to always specify a namespace when by title, so that the index is used. Even listing all known namespaces with IN() is better than omitting page_namespace from the WHERE clause.", + "unique": true + }, + { + "name": "page_random", + "columns": [ "page_random" ], + "comment": "Index for Special:Random", + "unique": false + }, + { + "name": "page_len", + "columns": [ "page_len" ], + "comment": "Questionable utility, used by ProofreadPage, possibly DynamicPageList. ApiQueryAllPages unconditionally filters on namespace and so hopefully does not use it.", + "unique": false + }, + { + "name": "page_redirect_namespace_len", + "columns": [ "page_is_redirect", "page_namespace", "page_len" ], + "comment": "The index for Special:Shortpages and Special:Longpages. Also SiteStats::articles() in 'comma' counting mode, MessageCache::loadFromDB().", + "unique": false + } + ], + "pk": [ "page_id" ] + }, + "after": { + "name": "page", + "comment": "Core of the wiki: each page has an entry here which identifies it by title and contains some essential metadata.", + "columns": [ + { + "name": "page_id", + "comment": "Unique identifier number. The page_id will be preserved across edits and rename operations, but not deletions and recreations.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "page_namespace", + "comment": "A page name is broken into a namespace and a title. The namespace keys are UI-language-independent constants, defined in includes/Defines.php", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "page_title", + "comment": "The rest of the title, as text. Spaces are transformed into underscores in title storage.", + "type": "binary", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "page_restrictions", + "comment": "Comma-separated set of permission keys indicating who can move or edit the page.", + "type": "blob", + "options": { "notnull": false, "length": 255 } + }, + { + "name": "page_is_redirect", + "comment": "1 indicates the article is a redirect.", + "type": "mwtinyint", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "page_is_new", + "comment": "1 indicates this is a new entry, with only one edit. Not all pages with one edit are new pages.", + "type": "mwtinyint", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "page_random", + "comment": "Random value between 0 and 1, used for Special:Randompage", + "type": "float", + "options": { + "notnull": true, + "unsigned": true, + "CustomSchemaOptions": { + "doublePrecision": true + } + } + }, + { + "name": "page_touched", + "comment": "This timestamp is updated whenever the page changes in a way requiring it to be re-rendered, invalidating caches. Aside from editing this includes permission changes, creation or deletion of linked pages, and alteration of contained templates.", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "page_links_updated", + "comment": "This timestamp is updated whenever a page is re-parsed and it has all the link tracking tables updated for it. This is useful for de-duplicating expensive backlink update jobs.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + }, + { + "name": "page_latest", + "comment": "Handy key to revision.rev_id of the current revision. This may be 0 during page creation, but that shouldn't happen outside of a transaction... hopefully.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "page_len", + "comment": "Uncompressed length in bytes of the page's current source text.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "page_content_model", + "comment": "content model, see CONTENT_MODEL_XXX constants", + "type": "binary", + "options": { "length": 32, "notnull": false } + }, + { + "name": "page_lang", + "comment": "Page content language", + "type": "binary", + "options": { "length": 35, "notnull": false } + } + ], + "indexes": [ + { + "name": "page_name_title", + "columns": [ "page_namespace", "page_title" ], + "comment": "The title index. Care must be taken to always specify a namespace when by title, so that the index is used. Even listing all known namespaces with IN() is better than omitting page_namespace from the WHERE clause.", + "unique": true + }, + { + "name": "page_random", + "columns": [ "page_random" ], + "comment": "Index for Special:Random", + "unique": false + }, + { + "name": "page_len", + "columns": [ "page_len" ], + "comment": "Questionable utility, used by ProofreadPage, possibly DynamicPageList. ApiQueryAllPages unconditionally filters on namespace and so hopefully does not use it.", + "unique": false + }, + { + "name": "page_redirect_namespace_len", + "columns": [ "page_is_redirect", "page_namespace", "page_len" ], + "comment": "The index for Special:Shortpages and Special:Longpages. Also SiteStats::articles() in 'comma' counting mode, MessageCache::loadFromDB().", + "unique": false + } + ], + "pk": [ "page_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-page_props-pp_page.json b/sql/abstractSchemaChanges/patch-page_props-pp_page.json new file mode 100644 index 000000000000..e3c70fd3696f --- /dev/null +++ b/sql/abstractSchemaChanges/patch-page_props-pp_page.json @@ -0,0 +1,65 @@ +{ + "comment": "Set unsigned true for pp_page in page_props table", + "before": { + "name": "page_props", + "comment": "Name/value pairs indexed by page_id", + "columns": [ + { + "name": "pp_page", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "pp_propname", + "type": "binary", + "options": { "length": 60, "notnull": true } + }, + { + "name": "pp_value", + "type": "blob", + "options": { "length": 65530, "notnull": true } + }, + { + "name": "pp_sortkey", + "type": "float", + "options": { "notnull": false } + } + ], + "indexes": [ + { "name": "pp_propname_page", "columns": [ "pp_propname", "pp_page" ], "unique": true }, + { "name": "pp_propname_sortkey_page", "columns": [ "pp_propname", "pp_sortkey", "pp_page" ], "unique": true, "options": { "where": "(pp_sortkey IS NOT NULL)" } } + ], + "pk": [ "pp_page", "pp_propname" ] + }, + "after": { + "name": "page_props", + "comment": "Name/value pairs indexed by page_id", + "columns": [ + { + "name": "pp_page", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "pp_propname", + "type": "binary", + "options": { "length": 60, "notnull": true } + }, + { + "name": "pp_value", + "type": "blob", + "options": { "length": 65530, "notnull": true } + }, + { + "name": "pp_sortkey", + "type": "float", + "options": { "notnull": false } + } + ], + "indexes": [ + { "name": "pp_propname_page", "columns": [ "pp_propname", "pp_page" ], "unique": true }, + { "name": "pp_propname_sortkey_page", "columns": [ "pp_propname", "pp_sortkey", "pp_page" ], "unique": true, "options": { "where": "(pp_sortkey IS NOT NULL)" } } + ], + "pk": [ "pp_page", "pp_propname" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-page_restrictions-pr_page.json b/sql/abstractSchemaChanges/patch-page_restrictions-pr_page.json new file mode 100644 index 000000000000..e9b2b9c30b53 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-page_restrictions-pr_page.json @@ -0,0 +1,109 @@ +{ + "comment": "Set unsigned true for pr_page in page_restrictions table", + "before": { + "name": "page_restrictions", + "comment": "Used for storing page restrictions (i.e. protection levels)", + "columns": [ + { + "name": "pr_id", + "comment": "Field for an ID for this restrictions row (sort-key for Special:ProtectedPages)", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "pr_page", + "comment": "Page to apply restrictions to (Foreign Key to page).", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "pr_type", + "comment": "The protection type (edit, move, etc)", + "type": "binary", + "options": { "length": 60, "notnull": true } + }, + { + "name": "pr_level", + "comment": "The protection level (Sysop, autoconfirmed, etc)", + "type": "binary", + "options": { "length": 60, "notnull": true } + }, + { + "name": "pr_cascade", + "type": "mwtinyint", + "options": { "notnull": true } + }, + { + "name": "pr_expiry", + "comment": "Field for time-limited protection.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + } + ], + "indexes": [ + { "name": "pr_pagetype", "columns": [ "pr_page", "pr_type" ], "unique": true }, + { "name": "pr_typelevel", "columns": [ "pr_type", "pr_level" ], "unique": false }, + { "name": "pr_level", "columns": [ "pr_level" ], "unique": false }, + { "name": "pr_cascade", "columns": [ "pr_cascade" ], "unique": false } + ], + "pk": [ "pr_id" ] + }, + "after": { + "name": "page_restrictions", + "comment": "Used for storing page restrictions (i.e. protection levels)", + "columns": [ + { + "name": "pr_id", + "comment": "Field for an ID for this restrictions row (sort-key for Special:ProtectedPages)", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "pr_page", + "comment": "Page to apply restrictions to (Foreign Key to page).", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "pr_type", + "comment": "The protection type (edit, move, etc)", + "type": "binary", + "options": { "length": 60, "notnull": true } + }, + { + "name": "pr_level", + "comment": "The protection level (Sysop, autoconfirmed, etc)", + "type": "binary", + "options": { "length": 60, "notnull": true } + }, + { + "name": "pr_cascade", + "type": "mwtinyint", + "options": { "notnull": true } + }, + { + "name": "pr_expiry", + "comment": "Field for time-limited protection.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + } + ], + "indexes": [ + { "name": "pr_pagetype", "columns": [ "pr_page", "pr_type" ], "unique": true }, + { "name": "pr_typelevel", "columns": [ "pr_type", "pr_level" ], "unique": false }, + { "name": "pr_level", "columns": [ "pr_level" ], "unique": false }, + { "name": "pr_cascade", "columns": [ "pr_cascade" ], "unique": false } + ], + "pk": [ "pr_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-pagelinks-drop-pl_title.json b/sql/abstractSchemaChanges/patch-pagelinks-drop-pl_title.json new file mode 100644 index 000000000000..a316c173255e --- /dev/null +++ b/sql/abstractSchemaChanges/patch-pagelinks-drop-pl_title.json @@ -0,0 +1,103 @@ +{ + "comment": "Drop old pagelinks columns (T299947)", + "before": { + "name": "pagelinks", + "comment": "Track page-to-page hyperlinks within the wiki. The target page may or may not exist, and due to renames and deletions may refer to different page records as time goes by.", + "columns": [ + { + "name": "pl_from", + "comment": "Key to the page_id of the page containing the link.", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "pl_namespace", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "pl_title", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "pl_from_namespace", + "type": "integer", + "comment": "Namespace for pl_from page", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "pl_target_id", + "type": "bigint", + "comment": "Foreign key to linktarget.lt_id", + "options": { "notnull": false, "unsigned": true } + } + ], + "indexes": [ + { + "name": "pl_namespace", + "columns": [ "pl_namespace", "pl_title", "pl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "pl_backlinks_namespace", + "columns": [ "pl_from_namespace", "pl_namespace", "pl_title", "pl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + }, + { + "name": "pl_target_id", + "columns": [ "pl_target_id", "pl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "pl_backlinks_namespace_target_id", + "columns": [ "pl_from_namespace", "pl_target_id", "pl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + } + ], + "pk": [ "pl_from", "pl_namespace", "pl_title" ] + }, + "after": { + "name": "pagelinks", + "comment": "Track page-to-page hyperlinks within the wiki. The target page may or may not exist, and due to renames and deletions may refer to different page records as time goes by.", + "columns": [ + { + "name": "pl_from", + "comment": "Key to the page_id of the page containing the link.", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "pl_from_namespace", + "type": "integer", + "comment": "Namespace for pl_from page", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "pl_target_id", + "type": "bigint", + "comment": "Foreign key to linktarget.lt_id", + "options": { "notnull": false, "unsigned": true } + } + ], + "indexes": [ + { + "name": "pl_target_id", + "columns": [ "pl_target_id", "pl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "pl_backlinks_namespace_target_id", + "columns": [ "pl_from_namespace", "pl_target_id", "pl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + } + ], + "pk": [ "pl_from", "pl_target_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-pagelinks-target_id.json b/sql/abstractSchemaChanges/patch-pagelinks-target_id.json new file mode 100644 index 000000000000..2c32b6fa1160 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-pagelinks-target_id.json @@ -0,0 +1,107 @@ +{ + "comment": "Add tl_target_id on pagelinks (T299947)", + "before": { + "name": "pagelinks", + "comment": "Track page-to-page hyperlinks within the wiki. The target page may or may not exist, and due to renames and deletions may refer to different page records as time goes by.", + "columns": [ + { + "name": "pl_from", + "comment": "Key to the page_id of the page containing the link.", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "pl_namespace", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "pl_title", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "pl_from_namespace", + "type": "integer", + "comment": "Namespace for pl_from page", + "options": { "notnull": true, "default": 0 } + } + ], + "indexes": [ + { + "name": "pl_namespace", + "columns": [ "pl_namespace", "pl_title", "pl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "pl_backlinks_namespace", + "columns": [ "pl_from_namespace", "pl_namespace", "pl_title", "pl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + } + ], + "pk": [ "pl_from", "pl_namespace", "pl_title" ] + }, + "after": { + "name": "pagelinks", + "comment": "Track page-to-page hyperlinks within the wiki. The target page may or may not exist, and due to renames and deletions may refer to different page records as time goes by.", + "columns": [ + { + "name": "pl_from", + "comment": "Key to the page_id of the page containing the link.", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "pl_namespace", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "pl_title", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "pl_from_namespace", + "type": "integer", + "comment": "Namespace for pl_from page", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "pl_target_id", + "type": "bigint", + "comment": "Foreign key to linktarget.lt_id", + "options": { "notnull": false, "unsigned": true } + } + ], + "indexes": [ + { + "name": "pl_namespace", + "columns": [ "pl_namespace", "pl_title", "pl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "pl_backlinks_namespace", + "columns": [ "pl_from_namespace", "pl_namespace", "pl_title", "pl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + }, + { + "name": "pl_target_id", + "columns": [ "pl_target_id", "pl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "pl_backlinks_namespace_target_id", + "columns": [ "pl_from_namespace", "pl_target_id", "pl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + } + ], + "pk": [ "pl_from", "pl_namespace", "pl_title" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-recentchanges-rc_id-bigint.json b/sql/abstractSchemaChanges/patch-recentchanges-rc_id-bigint.json new file mode 100644 index 000000000000..e8dc8a06f1be --- /dev/null +++ b/sql/abstractSchemaChanges/patch-recentchanges-rc_id-bigint.json @@ -0,0 +1,618 @@ +{ + "before": { + "name": "recentchanges", + "comment": "Primarily a summary table for Special:RecentChanges, this table contains some additional info on edits from the last few days", + "columns": [ + { + "name": "rc_id", + "type": "integer", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "rc_actor", + "comment": "As in revision", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_namespace", + "comment": "When pages are renamed, their RC entries do _not_ change.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_title", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "rc_comment_id", + "comment": "as in revision...", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_minor", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_bot", + "comment": "Edits by user accounts with the 'bot' rights key are marked with a 1 here, and will be hidden from the default view.", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_new", + "comment": "Set if this change corresponds to a page creation", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_cur_id", + "comment": "Key to page_id (was cur_id prior to 1.5). This will keep links working after moves while retaining the at-the-time name in the changes list.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_this_oldid", + "comment": "rev_id of the given revision", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_last_oldid", + "comment": "rev_id of the prior revision, for generating diff links.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_type", + "comment": "The type of change entry (RC_EDIT,RC_NEW,RC_LOG,RC_EXTERNAL)", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_source", + "comment": "The source of the change entry (replaces rc_type) default of '' is temporary, needed for initial migration", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 16 + } + }, + { + "name": "rc_patrolled", + "comment": "If the Recent Changes Patrol option is enabled, users may mark edits as having been reviewed to remove a warning flag on the RC list. A value of 1 indicates the page has been reviewed.", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_ip", + "comment": "Recorded IP address the edit was made from, if the $wgPutIPinRC option is enabled.", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 40 + } + }, + { + "name": "rc_old_len", + "comment": "Text length in characters before the edit", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "rc_new_len", + "comment": "Text length in characters after the edit", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "rc_deleted", + "comment": "Visibility of recent changes items, bitfield", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_logid", + "comment": "Value corresponding to log_id, specific log entries", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_log_type", + "comment": "Store log type info here, or null", + "type": "binary", + "options": { + "notnull": false, + "default": null, + "length": 255 + } + }, + { + "name": "rc_log_action", + "comment": "Store log action or null", + "type": "binary", + "options": { + "notnull": false, + "default": null, + "length": 255 + } + }, + { + "name": "rc_params", + "comment": "Log params", + "type": "blob", + "options": { + "notnull": false, + "length": 65535 + } + } + ], + "indexes": [ + { + "name": "rc_timestamp", + "comment": "Special:Recentchanges", + "columns": [ + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_namespace_title_timestamp", + "comment": "Special:Watchlist", + "columns": [ + "rc_namespace", + "rc_title", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_cur_id", + "comment": "Special:Recentchangeslinked when finding changes in pages linked from a page", + "columns": [ + "rc_cur_id" + ], + "unique": false + }, + { + "name": "rc_new_name_timestamp", + "comment": "Special:Newpages", + "columns": [ + "rc_new", + "rc_namespace", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_ip", + "comment": "Blank unless $wgPutIPinRC=true (false at WMF), possibly used by extensions, but mostly replaced by CheckUser.", + "columns": [ + "rc_ip" + ], + "unique": false + }, + { + "name": "rc_ns_actor", + "comment": "Probably intended for Special:NewPages namespace filter", + "columns": [ + "rc_namespace", + "rc_actor" + ], + "unique": false + }, + { + "name": "rc_actor", + "comment": "SiteStats active user count, Special:ActiveUsers, Special:NewPages user filter", + "columns": [ + "rc_actor", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_name_type_patrolled_timestamp", + "comment": "ApiQueryRecentChanges (T140108)", + "columns": [ + "rc_namespace", + "rc_type", + "rc_patrolled", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_this_oldid", + "comment": "Article.php and friends (T139012)", + "columns": [ + "rc_this_oldid" + ], + "unique": false + } + ], + "pk": [ + "rc_id" + ] + }, + "after": { + "name": "recentchanges", + "comment": "Primarily a summary table for Special:RecentChanges, this table contains some additional info on edits from the last few days", + "columns": [ + { + "name": "rc_id", + "type": "bigint", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "rc_actor", + "comment": "As in revision", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_namespace", + "comment": "When pages are renamed, their RC entries do _not_ change.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_title", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "rc_comment_id", + "comment": "as in revision...", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_minor", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_bot", + "comment": "Edits by user accounts with the 'bot' rights key are marked with a 1 here, and will be hidden from the default view.", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_new", + "comment": "Set if this change corresponds to a page creation", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_cur_id", + "comment": "Key to page_id (was cur_id prior to 1.5). This will keep links working after moves while retaining the at-the-time name in the changes list.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_this_oldid", + "comment": "rev_id of the given revision", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_last_oldid", + "comment": "rev_id of the prior revision, for generating diff links.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_type", + "comment": "The type of change entry (RC_EDIT,RC_NEW,RC_LOG,RC_EXTERNAL)", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_source", + "comment": "The source of the change entry (replaces rc_type) default of '' is temporary, needed for initial migration", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 16 + } + }, + { + "name": "rc_patrolled", + "comment": "If the Recent Changes Patrol option is enabled, users may mark edits as having been reviewed to remove a warning flag on the RC list. A value of 1 indicates the page has been reviewed.", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_ip", + "comment": "Recorded IP address the edit was made from, if the $wgPutIPinRC option is enabled.", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 40 + } + }, + { + "name": "rc_old_len", + "comment": "Text length in characters before the edit", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "rc_new_len", + "comment": "Text length in characters after the edit", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "rc_deleted", + "comment": "Visibility of recent changes items, bitfield", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_logid", + "comment": "Value corresponding to log_id, specific log entries", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_log_type", + "comment": "Store log type info here, or null", + "type": "binary", + "options": { + "notnull": false, + "default": null, + "length": 255 + } + }, + { + "name": "rc_log_action", + "comment": "Store log action or null", + "type": "binary", + "options": { + "notnull": false, + "default": null, + "length": 255 + } + }, + { + "name": "rc_params", + "comment": "Log params", + "type": "blob", + "options": { + "notnull": false, + "length": 65535 + } + } + ], + "indexes": [ + { + "name": "rc_timestamp", + "comment": "Special:Recentchanges", + "columns": [ + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_namespace_title_timestamp", + "comment": "Special:Watchlist", + "columns": [ + "rc_namespace", + "rc_title", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_cur_id", + "comment": "Special:Recentchangeslinked when finding changes in pages linked from a page", + "columns": [ + "rc_cur_id" + ], + "unique": false + }, + { + "name": "rc_new_name_timestamp", + "comment": "Special:Newpages", + "columns": [ + "rc_new", + "rc_namespace", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_ip", + "comment": "Blank unless $wgPutIPinRC=true (false at WMF), possibly used by extensions, but mostly replaced by CheckUser.", + "columns": [ + "rc_ip" + ], + "unique": false + }, + { + "name": "rc_ns_actor", + "comment": "Probably intended for Special:NewPages namespace filter", + "columns": [ + "rc_namespace", + "rc_actor" + ], + "unique": false + }, + { + "name": "rc_actor", + "comment": "SiteStats active user count, Special:ActiveUsers, Special:NewPages user filter", + "columns": [ + "rc_actor", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_name_type_patrolled_timestamp", + "comment": "ApiQueryRecentChanges (T140108)", + "columns": [ + "rc_namespace", + "rc_type", + "rc_patrolled", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_this_oldid", + "comment": "Article.php and friends (T139012)", + "columns": [ + "rc_this_oldid" + ], + "unique": false + } + ], + "pk": [ + "rc_id" + ] + } +} diff --git a/sql/abstractSchemaChanges/patch-recentchanges-rc_id.json b/sql/abstractSchemaChanges/patch-recentchanges-rc_id.json new file mode 100644 index 000000000000..975a45e46f51 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-recentchanges-rc_id.json @@ -0,0 +1,620 @@ +{ + "comment": "Set unsigned true for rc_id in recentchanges table (T62962)", + "before": { + "name": "recentchanges", + "comment": "Primarily a summary table for Special:RecentChanges, this table contains some additional info on edits from the last few days", + "columns": [ + { + "name": "rc_id", + "type": "integer", + "options": { + "autoincrement": true, + "notnull": true + } + }, + { + "name": "rc_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": true, + "length": 14 + } + }, + { + "name": "rc_actor", + "comment": "As in revision", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_namespace", + "comment": "When pages are renamed, their RC entries do _not_ change.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_title", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "rc_comment_id", + "comment": "as in revision...", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_minor", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_bot", + "comment": "Edits by user accounts with the 'bot' rights key are marked with a 1 here, and will be hidden from the default view.", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_new", + "comment": "Set if this change corresponds to a page creation", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_cur_id", + "comment": "Key to page_id (was cur_id prior to 1.5). This will keep links working after moves while retaining the at-the-time name in the changes list.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_this_oldid", + "comment": "rev_id of the given revision", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_last_oldid", + "comment": "rev_id of the prior revision, for generating diff links.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_type", + "comment": "The type of change entry (RC_EDIT,RC_NEW,RC_LOG,RC_EXTERNAL)", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_source", + "comment": "The source of the change entry (replaces rc_type) default of '' is temporary, needed for initial migration", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 16 + } + }, + { + "name": "rc_patrolled", + "comment": "If the Recent Changes Patrol option is enabled, users may mark edits as having been reviewed to remove a warning flag on the RC list. A value of 1 indicates the page has been reviewed.", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_ip", + "comment": "Recorded IP address the edit was made from, if the $wgPutIPinRC option is enabled.", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 40 + } + }, + { + "name": "rc_old_len", + "comment": "Text length in characters before the edit", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "rc_new_len", + "comment": "Text length in characters after the edit", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "rc_deleted", + "comment": "Visibility of recent changes items, bitfield", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_logid", + "comment": "Value corresponding to log_id, specific log entries", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_log_type", + "comment": "Store log type info here, or null", + "type": "binary", + "options": { + "notnull": false, + "default": null, + "length": 255 + } + }, + { + "name": "rc_log_action", + "comment": "Store log action or null", + "type": "binary", + "options": { + "notnull": false, + "default": null, + "length": 255 + } + }, + { + "name": "rc_params", + "comment": "Log params", + "type": "blob", + "options": { + "notnull": false, + "length": 65535 + } + } + ], + "indexes": [ + { + "name": "rc_timestamp", + "comment": "Special:Recentchanges", + "columns": [ + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_namespace_title_timestamp", + "comment": "Special:Watchlist", + "columns": [ + "rc_namespace", + "rc_title", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_cur_id", + "comment": "Special:Recentchangeslinked when finding changes in pages linked from a page", + "columns": [ + "rc_cur_id" + ], + "unique": false + }, + { + "name": "new_name_timestamp", + "comment": "Special:Newpages", + "columns": [ + "rc_new", + "rc_namespace", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_ip", + "comment": "Blank unless $wgPutIPinRC=true (false at WMF), possibly used by extensions, but mostly replaced by CheckUser.", + "columns": [ + "rc_ip" + ], + "unique": false + }, + { + "name": "rc_ns_actor", + "comment": "Probably intended for Special:NewPages namespace filter", + "columns": [ + "rc_namespace", + "rc_actor" + ], + "unique": false + }, + { + "name": "rc_actor", + "comment": "SiteStats active user count, Special:ActiveUsers, Special:NewPages user filter", + "columns": [ + "rc_actor", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_name_type_patrolled_timestamp", + "comment": "ApiQueryRecentChanges (T140108)", + "columns": [ + "rc_namespace", + "rc_type", + "rc_patrolled", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_this_oldid", + "comment": "Article.php and friends (T139012)", + "columns": [ + "rc_this_oldid" + ], + "unique": false + } + ], + "pk": [ + "rc_id" + ] + }, + "after": { + "name": "recentchanges", + "comment": "Primarily a summary table for Special:Recentchanges, this table contains some additional info on edits from the last few days, see Article::editUpdates()", + "columns": [ + { + "name": "rc_id", + "type": "integer", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": true, + "length": 14 + } + }, + { + "name": "rc_actor", + "comment": "As in revision", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_namespace", + "comment": "When pages are renamed, their RC entries do _not_ change.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_title", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "rc_comment_id", + "comment": "as in revision...", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_minor", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_bot", + "comment": "Edits by user accounts with the 'bot' rights key are marked with a 1 here, and will be hidden from the default view.", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_new", + "comment": "Set if this change corresponds to a page creation", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_cur_id", + "comment": "Key to page_id (was cur_id prior to 1.5). This will keep links working after moves while retaining the at-the-time name in the changes list.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_this_oldid", + "comment": "rev_id of the given revision", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_last_oldid", + "comment": "rev_id of the prior revision, for generating diff links.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_type", + "comment": "The type of change entry (RC_EDIT,RC_NEW,RC_LOG,RC_EXTERNAL)", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_source", + "comment": "The source of the change entry (replaces rc_type) default of '' is temporary, needed for initial migration", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 16 + } + }, + { + "name": "rc_patrolled", + "comment": "If the Recent Changes Patrol option is enabled, users may mark edits as having been reviewed to remove a warning flag on the RC list. A value of 1 indicates the page has been reviewed.", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_ip", + "comment": "Recorded IP address the edit was made from, if the $wgPutIPinRC option is enabled.", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 40 + } + }, + { + "name": "rc_old_len", + "comment": "Text length in characters before the edit", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "rc_new_len", + "comment": "Text length in characters after the edit", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "rc_deleted", + "comment": "Visibility of recent changes items, bitfield", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_logid", + "comment": "Value corresponding to log_id, specific log entries", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_log_type", + "comment": "Store log type info here, or null", + "type": "binary", + "options": { + "notnull": false, + "default": null, + "length": 255 + } + }, + { + "name": "rc_log_action", + "comment": "Store log action or null", + "type": "binary", + "options": { + "notnull": false, + "default": null, + "length": 255 + } + }, + { + "name": "rc_params", + "comment": "Log params", + "type": "blob", + "options": { + "notnull": false, + "length": 65535 + } + } + ], + "indexes": [ + { + "name": "rc_timestamp", + "comment": "Special:Recentchanges", + "columns": [ + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_namespace_title_timestamp", + "comment": "Special:Watchlist", + "columns": [ + "rc_namespace", + "rc_title", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_cur_id", + "comment": "Special:Recentchangeslinked when finding changes in pages linked from a page", + "columns": [ + "rc_cur_id" + ], + "unique": false + }, + { + "name": "new_name_timestamp", + "comment": "Special:Newpages", + "columns": [ + "rc_new", + "rc_namespace", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_ip", + "comment": "Blank unless $wgPutIPinRC=true (false at WMF), possibly used by extensions, but mostly replaced by CheckUser.", + "columns": [ + "rc_ip" + ], + "unique": false + }, + { + "name": "rc_ns_actor", + "comment": "Probably intended for Special:NewPages namespace filter", + "columns": [ + "rc_namespace", + "rc_actor" + ], + "unique": false + }, + { + "name": "rc_actor", + "comment": "SiteStats active user count, Special:ActiveUsers, Special:NewPages user filter", + "columns": [ + "rc_actor", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_name_type_patrolled_timestamp", + "comment": "ApiQueryRecentChanges (T140108)", + "columns": [ + "rc_namespace", + "rc_type", + "rc_patrolled", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_this_oldid", + "comment": "Article.php and friends (T139012)", + "columns": [ + "rc_this_oldid" + ], + "unique": false + } + ], + "pk": [ + "rc_id" + ] + } +} diff --git a/sql/abstractSchemaChanges/patch-recentchanges-rc_new_name_timestamp.json b/sql/abstractSchemaChanges/patch-recentchanges-rc_new_name_timestamp.json new file mode 100644 index 000000000000..acae5e199049 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-recentchanges-rc_new_name_timestamp.json @@ -0,0 +1,621 @@ +{ + "comment": "Renaming new_name_timestamp index on recentchanges to rc_new_name_timestamp (T270033)", + "before": { + "name": "recentchanges", + "comment": "Primarily a summary table for Special:Recentchanges, this table contains some additional info on edits from the last few days, see Article::editUpdates()", + "columns": [ + { + "name": "rc_id", + "type": "integer", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": true, + "length": 14 + } + }, + { + "name": "rc_actor", + "comment": "As in revision", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_namespace", + "comment": "When pages are renamed, their RC entries do _not_ change.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_title", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "rc_comment_id", + "comment": "as in revision...", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_minor", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_bot", + "comment": "Edits by user accounts with the 'bot' rights key are marked with a 1 here, and will be hidden from the default view.", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_new", + "comment": "Set if this change corresponds to a page creation", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_cur_id", + "comment": "Key to page_id (was cur_id prior to 1.5). This will keep links working after moves while retaining the at-the-time name in the changes list.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_this_oldid", + "comment": "rev_id of the given revision", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_last_oldid", + "comment": "rev_id of the prior revision, for generating diff links.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_type", + "comment": "The type of change entry (RC_EDIT,RC_NEW,RC_LOG,RC_EXTERNAL)", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_source", + "comment": "The source of the change entry (replaces rc_type) default of '' is temporary, needed for initial migration", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 16 + } + }, + { + "name": "rc_patrolled", + "comment": "If the Recent Changes Patrol option is enabled, users may mark edits as having been reviewed to remove a warning flag on the RC list. A value of 1 indicates the page has been reviewed.", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_ip", + "comment": "Recorded IP address the edit was made from, if the $wgPutIPinRC option is enabled.", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 40 + } + }, + { + "name": "rc_old_len", + "comment": "Text length in characters before the edit", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "rc_new_len", + "comment": "Text length in characters after the edit", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "rc_deleted", + "comment": "Visibility of recent changes items, bitfield", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_logid", + "comment": "Value corresponding to log_id, specific log entries", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_log_type", + "comment": "Store log type info here, or null", + "type": "binary", + "options": { + "notnull": false, + "default": null, + "length": 255 + } + }, + { + "name": "rc_log_action", + "comment": "Store log action or null", + "type": "binary", + "options": { + "notnull": false, + "default": null, + "length": 255 + } + }, + { + "name": "rc_params", + "comment": "Log params", + "type": "blob", + "options": { + "notnull": false, + "length": 65535 + } + } + ], + "indexes": [ + { + "name": "rc_timestamp", + "comment": "Special:Recentchanges", + "columns": [ + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_namespace_title_timestamp", + "comment": "Special:Watchlist", + "columns": [ + "rc_namespace", + "rc_title", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_cur_id", + "comment": "Special:Recentchangeslinked when finding changes in pages linked from a page", + "columns": [ + "rc_cur_id" + ], + "unique": false + }, + { + "name": "new_name_timestamp", + "comment": "Special:Newpages", + "columns": [ + "rc_new", + "rc_namespace", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_ip", + "comment": "Blank unless $wgPutIPinRC=true (false at WMF), possibly used by extensions, but mostly replaced by CheckUser.", + "columns": [ + "rc_ip" + ], + "unique": false + }, + { + "name": "rc_ns_actor", + "comment": "Probably intended for Special:NewPages namespace filter", + "columns": [ + "rc_namespace", + "rc_actor" + ], + "unique": false + }, + { + "name": "rc_actor", + "comment": "SiteStats active user count, Special:ActiveUsers, Special:NewPages user filter", + "columns": [ + "rc_actor", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_name_type_patrolled_timestamp", + "comment": "ApiQueryRecentChanges (T140108)", + "columns": [ + "rc_namespace", + "rc_type", + "rc_patrolled", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_this_oldid", + "comment": "Article.php and friends (T139012)", + "columns": [ + "rc_this_oldid" + ], + "unique": false + } + ], + "pk": [ + "rc_id" + ] + }, + "after": { + "name": "recentchanges", + "comment": "Primarily a summary table for Special:RecentChanges, this table contains some additional info on edits from the last few days", + "columns": [ + { + "name": "rc_id", + "type": "integer", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": true, + "length": 14 + } + }, + { + "name": "rc_actor", + "comment": "As in revision", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_namespace", + "comment": "When pages are renamed, their RC entries do _not_ change.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_title", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "rc_comment_id", + "comment": "as in revision...", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_minor", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_bot", + "comment": "Edits by user accounts with the 'bot' rights key are marked with a 1 here, and will be hidden from the default view.", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_new", + "comment": "Set if this change corresponds to a page creation", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_cur_id", + "comment": "Key to page_id (was cur_id prior to 1.5). This will keep links working after moves while retaining the at-the-time name in the changes list.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_this_oldid", + "comment": "rev_id of the given revision", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_last_oldid", + "comment": "rev_id of the prior revision, for generating diff links.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_type", + "comment": "The type of change entry (RC_EDIT,RC_NEW,RC_LOG,RC_EXTERNAL)", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_source", + "comment": "The source of the change entry (replaces rc_type) default of '' is temporary, needed for initial migration", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 16 + } + }, + { + "name": "rc_patrolled", + "comment": "If the Recent Changes Patrol option is enabled, users may mark edits as having been reviewed to remove a warning flag on the RC list. A value of 1 indicates the page has been reviewed.", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_ip", + "comment": "Recorded IP address the edit was made from, if the $wgPutIPinRC option is enabled.", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 40 + } + }, + { + "name": "rc_old_len", + "comment": "Text length in characters before the edit", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "rc_new_len", + "comment": "Text length in characters after the edit", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "rc_deleted", + "comment": "Visibility of recent changes items, bitfield", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_logid", + "comment": "Value corresponding to log_id, specific log entries", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_log_type", + "comment": "Store log type info here, or null", + "type": "binary", + "options": { + "notnull": false, + "default": null, + "length": 255 + } + }, + { + "name": "rc_log_action", + "comment": "Store log action or null", + "type": "binary", + "options": { + "notnull": false, + "default": null, + "length": 255 + } + }, + { + "name": "rc_params", + "comment": "Log params", + "type": "blob", + "options": { + "notnull": false, + "length": 65535 + } + } + ], + "indexes": [ + { + "name": "rc_timestamp", + "comment": "Special:Recentchanges", + "columns": [ + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_namespace_title_timestamp", + "comment": "Special:Watchlist", + "columns": [ + "rc_namespace", + "rc_title", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_cur_id", + "comment": "Special:Recentchangeslinked when finding changes in pages linked from a page", + "columns": [ + "rc_cur_id" + ], + "unique": false + }, + { + "name": "rc_new_name_timestamp", + "comment": "Special:Newpages", + "columns": [ + "rc_new", + "rc_namespace", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_ip", + "comment": "Blank unless $wgPutIPinRC=true (false at WMF), possibly used by extensions, but mostly replaced by CheckUser.", + "columns": [ + "rc_ip" + ], + "unique": false + }, + { + "name": "rc_ns_actor", + "comment": "Probably intended for Special:NewPages namespace filter", + "columns": [ + "rc_namespace", + "rc_actor" + ], + "unique": false + }, + { + "name": "rc_actor", + "comment": "SiteStats active user count, Special:ActiveUsers, Special:NewPages user filter", + "columns": [ + "rc_actor", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_name_type_patrolled_timestamp", + "comment": "ApiQueryRecentChanges (T140108)", + "columns": [ + "rc_namespace", + "rc_type", + "rc_patrolled", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_this_oldid", + "comment": "Article.php and friends (T139012)", + "columns": [ + "rc_this_oldid" + ], + "unique": false + } + ], + "pk": [ + "rc_id" + ] + } +} diff --git a/sql/abstractSchemaChanges/patch-revision-cleanup.json b/sql/abstractSchemaChanges/patch-revision-cleanup.json new file mode 100644 index 000000000000..1c24e7070623 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-revision-cleanup.json @@ -0,0 +1,188 @@ +{ + "before": { + "name": "revision", + "comment": "Every edit of a page creates also a revision row. This stores metadata about the revision, and a reference to the text storage backend.", + "columns": [ + { + "name": "rev_id", + "comment": "Unique ID to identify each revision", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "rev_page", + "comment": "Key to page_id. This should never be invalid", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "rev_comment_id", + "comment": "Key to comment.comment_id. Comment summarizing the change", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "rev_actor", + "comment": "Key to actor.actor_id of the user or IP who made this edit", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "rev_timestamp", + "comment": "Timestamp of when revision was created", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "rev_minor_edit", + "comment": "Records whether the user marked the 'minor edit' checkbox. Many automated edits are marked as minor", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rev_deleted", + "comment": "Restrictions on who can access this revision", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rev_len", + "comment": "Length of this revision in bytes", + "type": "integer", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "rev_parent_id", + "comment": "Key to revision.rev_id. This field is used to add support for a tree structure (The Adjacency List Model)", + "type": "integer", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "rev_sha1", + "comment": "SHA-1 text content hash in base-36", + "type": "binary", + "options": { "length": 32, "notnull": true, "default": "" } + } + ], + "indexes": [ + { + "name": "rev_timestamp", + "columns": [ "rev_timestamp" ], + "comment": "Used by ApiQueryAllRevisions", + "unique": false + }, + { + "name": "rev_page_timestamp", + "columns": [ "rev_page", "rev_timestamp" ], + "comment": "History index", + "unique": false + }, + { + "name": "rev_actor_timestamp", + "columns": [ "rev_actor", "rev_timestamp", "rev_id" ], + "comment": "User contributions index", + "unique": false + }, + { + "name": "rev_page_actor_timestamp", + "columns": [ "rev_page", "rev_actor", "rev_timestamp" ], + "comment": "Credits index. This is scanned in order to compile credits lists for pages, in ApiQueryContributors. Also for ApiQueryRevisions if rvuser is specified", + "unique": false + } + ], + "pk": [ "rev_id" ] + }, + "after": { + "name": "revision", + "comment": "Every edit of a page creates also a revision row. This stores metadata about the revision, and a reference to the text storage backend.", + "columns": [ + { + "name": "rev_id", + "comment": "Unique ID to identify each revision", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "rev_page", + "comment": "Key to page_id. This should never be invalid", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "rev_comment_id", + "comment": "Key to comment.comment_id. Comment summarizing the change", + "type": "bigint", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "rev_actor", + "comment": "Key to actor.actor_id of the user or IP who made this edit", + "type": "bigint", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "rev_timestamp", + "comment": "Timestamp of when revision was created", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "rev_minor_edit", + "comment": "Records whether the user marked the 'minor edit' checkbox. Many automated edits are marked as minor", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rev_deleted", + "comment": "Restrictions on who can access this revision", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rev_len", + "comment": "Length of this revision in bytes", + "type": "integer", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "rev_parent_id", + "comment": "Key to revision.rev_id. This field is used to add support for a tree structure (The Adjacency List Model)", + "type": "bigint", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "rev_sha1", + "comment": "SHA-1 text content hash in base-36", + "type": "binary", + "options": { "length": 32, "notnull": true, "default": "" } + } + ], + "indexes": [ + { + "name": "rev_timestamp", + "columns": [ "rev_timestamp" ], + "comment": "Used by ApiQueryAllRevisions", + "unique": false + }, + { + "name": "rev_page_timestamp", + "columns": [ "rev_page", "rev_timestamp" ], + "comment": "History index", + "unique": false + }, + { + "name": "rev_actor_timestamp", + "columns": [ "rev_actor", "rev_timestamp", "rev_id" ], + "comment": "User contributions index", + "unique": false + }, + { + "name": "rev_page_actor_timestamp", + "columns": [ "rev_page", "rev_actor", "rev_timestamp" ], + "comment": "Credits index. This is scanned in order to compile credits lists for pages, in ApiQueryContributors. Also for ApiQueryRevisions if rvuser is specified", + "unique": false + } + ], + "pk": [ "rev_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-revision-rename-index.json b/sql/abstractSchemaChanges/patch-revision-rename-index.json new file mode 100644 index 000000000000..db31878545f8 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-revision-rename-index.json @@ -0,0 +1,203 @@ +{ + "comment": "Rename page_timestamp index to have 'rev_' prefix (T270033)", + "before": { + "name": "revision", + "comment": "Every edit of a page creates also a revision row. This stores metadata about the revision, and a reference to the text storage backend.", + "columns": [ + { + "name": "rev_id", + "comment": "Unique ID to identify each revision", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "rev_page", + "comment": "Key to page_id. This should never be invalid", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "rev_comment_id", + "comment": "Key to comment.comment_id. Comment summarizing the change", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "rev_actor", + "comment": "Key to actor.actor_id of the user or IP who made this edit", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "rev_timestamp", + "comment": "Timestamp of when revision was created", + "type": "mwtimestamp", + "options": { "notnull": true, "default": "" } + }, + { + "name": "rev_minor_edit", + "comment": "Records whether the user marked the 'minor edit' checkbox. Many automated edits are marked as minor", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rev_deleted", + "comment": "Restrictions on who can access this revision", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rev_len", + "comment": "Length of this revision in bytes", + "type": "integer", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "rev_parent_id", + "comment": "Key to revision.rev_id. This field is used to add support for a tree structure (The Adjacency List Model)", + "type": "integer", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "rev_sha1", + "comment": "SHA-1 text content hash in base-36", + "type": "binary", + "options": { "length": 32, "notnull": true, "default": "" } + } + ], + "indexes": [ + { + "name": "rev_page_id", + "columns": [ "rev_page", "rev_id" ], + "comment": "The index is proposed for removal, do not use it in new code: T163532. Used for ordering revisions within a page by rev_id, which is usually incorrect, since rev_timestamp is normally the correct order. It can also be used by dumpBackup.php, if a page and rev_id range is specified.", + "unique": false + }, + { + "name": "rev_timestamp", + "columns": [ "rev_timestamp" ], + "comment": "Used by ApiQueryAllRevisions", + "unique": false + }, + { + "name": "page_timestamp", + "columns": [ "rev_page", "rev_timestamp" ], + "comment": "History index", + "unique": false + }, + { + "name": "rev_actor_timestamp", + "columns": [ "rev_actor", "rev_timestamp", "rev_id" ], + "comment": "User contributions index", + "unique": false + }, + { + "name": "rev_page_actor_timestamp", + "columns": [ "rev_page", "rev_actor", "rev_timestamp" ], + "comment": "Credits index. This is scanned in order to compile credits lists for pages, in ApiQueryContributors. Also for ApiQueryRevisions if rvuser is specified", + "unique": false + } + ], + "table_options": [ "/*$wgDBTableOptions*/", "MAX_ROWS=10000000", "AVG_ROW_LENGTH=1024" ], + "pk": [ "rev_id" ] + }, + "after": { + "name": "revision", + "comment": "Every edit of a page creates also a revision row. This stores metadata about the revision, and a reference to the text storage backend.", + "columns": [ + { + "name": "rev_id", + "comment": "Unique ID to identify each revision", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "rev_page", + "comment": "Key to page_id. This should never be invalid", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "rev_comment_id", + "comment": "Key to comment.comment_id. Comment summarizing the change", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "rev_actor", + "comment": "Key to actor.actor_id of the user or IP who made this edit", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "rev_timestamp", + "comment": "Timestamp of when revision was created", + "type": "mwtimestamp", + "options": { "notnull": true, "default": "" } + }, + { + "name": "rev_minor_edit", + "comment": "Records whether the user marked the 'minor edit' checkbox. Many automated edits are marked as minor", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rev_deleted", + "comment": "Restrictions on who can access this revision", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rev_len", + "comment": "Length of this revision in bytes", + "type": "integer", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "rev_parent_id", + "comment": "Key to revision.rev_id. This field is used to add support for a tree structure (The Adjacency List Model)", + "type": "integer", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "rev_sha1", + "comment": "SHA-1 text content hash in base-36", + "type": "binary", + "options": { "length": 32, "notnull": true, "default": "" } + } + ], + "indexes": [ + { + "name": "rev_page_id", + "columns": [ "rev_page", "rev_id" ], + "comment": "The index is proposed for removal, do not use it in new code: T163532. Used for ordering revisions within a page by rev_id, which is usually incorrect, since rev_timestamp is normally the correct order. It can also be used by dumpBackup.php, if a page and rev_id range is specified.", + "unique": false + }, + { + "name": "rev_timestamp", + "columns": [ "rev_timestamp" ], + "comment": "Used by ApiQueryAllRevisions", + "unique": false + }, + { + "name": "rev_page_timestamp", + "columns": [ "rev_page", "rev_timestamp" ], + "comment": "History index", + "unique": false + }, + { + "name": "rev_actor_timestamp", + "columns": [ "rev_actor", "rev_timestamp", "rev_id" ], + "comment": "User contributions index", + "unique": false + }, + { + "name": "rev_page_actor_timestamp", + "columns": [ "rev_page", "rev_actor", "rev_timestamp" ], + "comment": "Credits index. This is scanned in order to compile credits lists for pages, in ApiQueryContributors. Also for ApiQueryRevisions if rvuser is specified", + "unique": false + } + ], + "table_options": [ "/*$wgDBTableOptions*/", "MAX_ROWS=10000000", "AVG_ROW_LENGTH=1024" ], + "pk": [ "rev_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-searchindex-pk-titlelength.json b/sql/abstractSchemaChanges/patch-searchindex-pk-titlelength.json new file mode 100644 index 000000000000..9ff3bce55428 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-searchindex-pk-titlelength.json @@ -0,0 +1,131 @@ +{ + "comment": "Searchindex with PK (T249976), InnoDB (T107875), larger title (T231827)", + "before": { + "columns": [ + { + "name": "si_page", + "type": "integer", + "comment": "Key to page_id", + "options": { + "notnull": true, + "unsigned": true + } + }, + { + "name": "si_title", + "type": "string", + "comment": "Munged version of title", + "options": { + "default": "", + "length": 255, + "notnull": true + } + }, + { + "name": "si_text", + "type": "text", + "comment": "Munged version of body text", + "options": { + "length": 16777215, + "notnull": true + } + } + ], + "comment": "search backend, this is actively used in MySQL but created and not used in Postgres while there are plans to use it in the future (T220450). This table must be MyISAM in MySQL; InnoDB does not support the needed fulltext index.", + "indexes": [ + { + "name": "si_page", + "columns": [ + "si_page" + ], + "unique": true + }, + { + "name": "si_title", + "columns": [ + "si_title" + ], + "flags": [ + "fulltext" + ], + "unique": false + }, + { + "name": "si_text", + "columns": [ + "si_text" + ], + "flags": [ + "fulltext" + ], + "unique": false + } + ], + "name": "searchindex", + "pk": [], + "table_options": [ + "ENGINE=MyISAM", + "DEFAULT CHARSET=utf8" + ] + }, + "after": { + "columns": [ + { + "name": "si_page", + "type": "integer", + "comment": "Key to page_id", + "options": { + "notnull": true, + "unsigned": true + } + }, + { + "name": "si_title", + "type": "string", + "comment": "Munged version of title", + "options": { + "length": 16777215, + "notnull": true + } + }, + { + "name": "si_text", + "type": "text", + "comment": "Munged version of body text", + "options": { + "length": 16777215, + "notnull": true + } + } + ], + "comment": "search backend, this is actively used in MySQL but created and not used in Postgres while there are plans to use it in the future (T220450). This table must be MyISAM in MySQL; InnoDB does not support the needed fulltext index.", + "indexes": [ + { + "name": "si_title", + "columns": [ + "si_title" + ], + "flags": [ + "fulltext" + ], + "unique": false + }, + { + "name": "si_text", + "columns": [ + "si_text" + ], + "flags": [ + "fulltext" + ], + "unique": false + } + ], + "name": "searchindex", + "pk": [ "si_page" ], + "table_options": [ + "ENGINE=MyISAM", + "DEFAULT CHARSET=utf8mb4" + ] + } +} diff --git a/sql/abstractSchemaChanges/patch-site_identifiers-rename-indexes.json b/sql/abstractSchemaChanges/patch-site_identifiers-rename-indexes.json new file mode 100644 index 000000000000..76a561a00448 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-site_identifiers-rename-indexes.json @@ -0,0 +1,61 @@ +{ + "comment": "Rename indexes to have uniform si_ prefix with the columns (T270033)", + "before": { + "name": "site_identifiers", + "comment": "Links local site identifiers to their corresponding site.", + "columns": [ + { + "name": "si_type", + "comment": "local key type, ie 'interwiki' or 'langlink'", + "type": "binary", + "options": { "length": 32, "notnull": true } + }, + { + "name": "si_key", + "comment": "local key value, ie 'en' or 'wiktionary'", + "type": "binary", + "options": { "length": 32, "notnull": true } + }, + { + "name": "si_site", + "comment": "Key on sites.site_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + } + ], + "indexes": [ + { "name": "site_ids_site", "columns": [ "si_site" ], "unique": false }, + { "name": "site_ids_key", "columns": [ "si_key" ], "unique": false } + ], + "pk": [ "si_type", "si_key" ] + }, + "after": { + "name": "site_identifiers", + "comment": "Links local site identifiers to their corresponding site.", + "columns": [ + { + "name": "si_type", + "comment": "local key type, ie 'interwiki' or 'langlink'", + "type": "binary", + "options": { "length": 32, "notnull": true } + }, + { + "name": "si_key", + "comment": "local key value, ie 'en' or 'wiktionary'", + "type": "binary", + "options": { "length": 32, "notnull": true } + }, + { + "name": "si_site", + "comment": "Key on sites.site_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + } + ], + "indexes": [ + { "name": "si_site", "columns": [ "si_site" ], "unique": false }, + { "name": "si_key", "columns": [ "si_key" ], "unique": false } + ], + "pk": [ "si_type", "si_key" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-sites-drop_indexes.json b/sql/abstractSchemaChanges/patch-sites-drop_indexes.json new file mode 100644 index 000000000000..62c32d26b3ae --- /dev/null +++ b/sql/abstractSchemaChanges/patch-sites-drop_indexes.json @@ -0,0 +1,162 @@ +{ + "comment": "Drop unused indexes of sites table", + "before": { + "name": "sites", + "comment": "Holds all the sites known to the wiki.", + "columns": [ + { + "name": "site_id", + "type": "integer", + "comment": "Numeric id of the site", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "site_global_key", + "type": "binary", + "comment": "Global identifier for the site, ie 'enwiktionary'", + "options": { "notnull": true, "length": 64 } + }, + { + "name": "site_type", + "type": "binary", + "comment": "Type of the site, ie 'mediawiki'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_group", + "type": "binary", + "comment": "Group of the site, ie 'wikipedia'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_source", + "type": "binary", + "comment": "Source of the site data, ie 'local', 'wikidata', 'my-magical-repo'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_language", + "type": "binary", + "comment": "Language code of the sites primary language.", + "options": { "notnull": true, "length": 35 } + }, + { + "name": "site_protocol", + "type": "binary", + "comment": "Protocol of the site, ie 'http://', 'irc://', '//'. This field is an index for lookups and is build from type specific data in site_data.", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_domain", + "type": "string", + "comment": "Domain of the site in reverse order, ie 'org.mediawiki.www.'. This field is an index for lookups and is build from type specific data in site_data.", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "site_data", + "type": "blob", + "comment": "Type dependent site data.", + "options": { "notnull": true, "length": 65530 } + }, + { + "name": "site_forward", + "type": "mwtinyint", + "comment": "If site.tld/path/key:pageTitle should forward users to the page on the actual site, where \"key\" is the local identifier.", + "options": { "notnull": true, "length": 1 } + }, + { + "name": "site_config", + "type": "blob", + "comment": "Type dependent site config. For instance if template transclusion should be allowed if it's a MediaWiki.", + "options": { "notnull": true, "length": 65530 } + } + ], + "indexes": [ + { "name": "site_global_key", "columns": [ "site_global_key" ], "unique": true }, + { "name": "site_type", "columns": [ "site_type" ], "unique": false }, + { "name": "site_group", "columns": [ "site_group" ], "unique": false }, + { "name": "site_source", "columns": [ "site_source" ], "unique": false }, + { "name": "site_language", "columns": [ "site_language" ], "unique": false }, + { "name": "site_protocol", "columns": [ "site_protocol" ], "unique": false }, + { "name": "site_domain", "columns": [ "site_domain" ], "unique": false }, + { "name": "site_forward", "columns": [ "site_forward" ], "unique": false } + ], + "pk": [ "site_id" ] + }, + "after": { + "name": "sites", + "comment": "Holds all the sites known to the wiki.", + "columns": [ + { + "name": "site_id", + "type": "integer", + "comment": "Numeric id of the site", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "site_global_key", + "type": "binary", + "comment": "Global identifier for the site, ie 'enwiktionary'", + "options": { "notnull": true, "length": 64 } + }, + { + "name": "site_type", + "type": "binary", + "comment": "Type of the site, ie 'mediawiki'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_group", + "type": "binary", + "comment": "Group of the site, ie 'wikipedia'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_source", + "type": "binary", + "comment": "Source of the site data, ie 'local', 'wikidata', 'my-magical-repo'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_language", + "type": "binary", + "comment": "Language code of the sites primary language.", + "options": { "notnull": true, "length": 35 } + }, + { + "name": "site_protocol", + "type": "binary", + "comment": "Protocol of the site, ie 'http://', 'irc://', '//'. This field is an index for lookups and is build from type specific data in site_data.", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_domain", + "type": "string", + "comment": "Domain of the site in reverse order, ie 'org.mediawiki.www.'. This field is an index for lookups and is build from type specific data in site_data.", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "site_data", + "type": "blob", + "comment": "Type dependent site data.", + "options": { "notnull": true, "length": 65530 } + }, + { + "name": "site_forward", + "type": "mwtinyint", + "comment": "If site.tld/path/key:pageTitle should forward users to the page on the actual site, where \"key\" is the local identifier.", + "options": { "notnull": true, "length": 1 } + }, + { + "name": "site_config", + "type": "blob", + "comment": "Type dependent site config. For instance if template transclusion should be allowed if it's a MediaWiki.", + "options": { "notnull": true, "length": 65530 } + } + ], + "indexes": [ + { "name": "site_global_key", "columns": [ "site_global_key" ], "unique": true } + ], + "pk": [ "site_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-sites-rename-indexes.json b/sql/abstractSchemaChanges/patch-sites-rename-indexes.json new file mode 100644 index 000000000000..1d2e57ae17e3 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-sites-rename-indexes.json @@ -0,0 +1,169 @@ +{ + "comment": "Rename all indexes to have 'site_' prefix (T270033)", + "before": { + "name": "sites", + "comment": "Holds all the sites known to the wiki.", + "columns": [ + { + "name": "site_id", + "type": "integer", + "comment": "Numeric id of the site", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "site_global_key", + "type": "binary", + "comment": "Global identifier for the site, ie 'enwiktionary'", + "options": { "notnull": true, "length": 64 } + }, + { + "name": "site_type", + "type": "binary", + "comment": "Type of the site, ie 'mediawiki'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_group", + "type": "binary", + "comment": "Group of the site, ie 'wikipedia'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_source", + "type": "binary", + "comment": "Source of the site data, ie 'local', 'wikidata', 'my-magical-repo'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_language", + "type": "binary", + "comment": "Language code of the sites primary language.", + "options": { "notnull": true, "length": 35 } + }, + { + "name": "site_protocol", + "type": "binary", + "comment": "Protocol of the site, ie 'http://', 'irc://', '//'. This field is an index for lookups and is build from type specific data in site_data.", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_domain", + "type": "string", + "comment": "Domain of the site in reverse order, ie 'org.mediawiki.www.'. This field is an index for lookups and is build from type specific data in site_data.", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "site_data", + "type": "blob", + "comment": "Type dependent site data.", + "options": { "notnull": true, "length": 65530 } + }, + { + "name": "site_forward", + "type": "mwtinyint", + "comment": "If site.tld/path/key:pageTitle should forward users to the page on the actual site, where \"key\" is the local identifier.", + "options": { "notnull": true, "length": 1 } + }, + { + "name": "site_config", + "type": "blob", + "comment": "Type dependent site config. For instance if template transclusion should be allowed if it's a MediaWiki.", + "options": { "notnull": true, "length": 65530 } + } + ], + "indexes": [ + { "name": "sites_global_key", "columns": [ "site_global_key" ], "unique": true }, + { "name": "sites_type", "columns": [ "site_type" ], "unique": false }, + { "name": "sites_group", "columns": [ "site_group" ], "unique": false }, + { "name": "sites_source", "columns": [ "site_source" ], "unique": false }, + { "name": "sites_language", "columns": [ "site_language" ], "unique": false }, + { "name": "sites_protocol", "columns": [ "site_protocol" ], "unique": false }, + { "name": "sites_domain", "columns": [ "site_domain" ], "unique": false }, + { "name": "sites_forward", "columns": [ "site_forward" ], "unique": false } + ], + "pk": [ "site_id" ] + }, + "after": { + "name": "sites", + "comment": "Holds all the sites known to the wiki.", + "columns": [ + { + "name": "site_id", + "type": "integer", + "comment": "Numeric id of the site", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "site_global_key", + "type": "binary", + "comment": "Global identifier for the site, ie 'enwiktionary'", + "options": { "notnull": true, "length": 64 } + }, + { + "name": "site_type", + "type": "binary", + "comment": "Type of the site, ie 'mediawiki'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_group", + "type": "binary", + "comment": "Group of the site, ie 'wikipedia'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_source", + "type": "binary", + "comment": "Source of the site data, ie 'local', 'wikidata', 'my-magical-repo'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_language", + "type": "binary", + "comment": "Language code of the sites primary language.", + "options": { "notnull": true, "length": 35 } + }, + { + "name": "site_protocol", + "type": "binary", + "comment": "Protocol of the site, ie 'http://', 'irc://', '//'. This field is an index for lookups and is build from type specific data in site_data.", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_domain", + "type": "string", + "comment": "Domain of the site in reverse order, ie 'org.mediawiki.www.'. This field is an index for lookups and is build from type specific data in site_data.", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "site_data", + "type": "blob", + "comment": "Type dependent site data.", + "options": { "notnull": true, "length": 65530 } + }, + { + "name": "site_forward", + "type": "mwtinyint", + "comment": "If site.tld/path/key:pageTitle should forward users to the page on the actual site, where \"key\" is the local identifier.", + "options": { "notnull": true, "length": 1 } + }, + { + "name": "site_config", + "type": "blob", + "comment": "Type dependent site config. For instance if template transclusion should be allowed if it's a MediaWiki.", + "options": { "notnull": true, "length": 65530 } + } + ], + "indexes": [ + { "name": "site_global_key", "columns": [ "site_global_key" ], "unique": true }, + { "name": "site_type", "columns": [ "site_type" ], "unique": false }, + { "name": "site_group", "columns": [ "site_group" ], "unique": false }, + { "name": "site_source", "columns": [ "site_source" ], "unique": false }, + { "name": "site_language", "columns": [ "site_language" ], "unique": false }, + { "name": "site_protocol", "columns": [ "site_protocol" ], "unique": false }, + { "name": "site_domain", "columns": [ "site_domain" ], "unique": false }, + { "name": "site_forward", "columns": [ "site_forward" ], "unique": false } + ], + "pk": [ "site_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-templatelinks-drop-tl_title.json b/sql/abstractSchemaChanges/patch-templatelinks-drop-tl_title.json new file mode 100644 index 000000000000..acaf715f5112 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-templatelinks-drop-tl_title.json @@ -0,0 +1,103 @@ +{ + "comment": "Drop tl_title column (and more) on templatelinks (T299417)", + "before": { + "name": "templatelinks", + "comment": "Track template inclusions. The target page may or may not exist, and due to renames and deletions may refer to different page records as time goes by.", + "columns": [ + { + "name": "tl_from", + "comment": "Key to the page_id of the page containing the link.", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "tl_from_namespace", + "type": "integer", + "comment": "Namespace for this page", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "tl_namespace", + "type": "integer", + "options": { "default": 0 } + }, + { + "name": "tl_title", + "type": "binary", + "options": { "length": 255, "default": "" } + }, + { + "name": "tl_target_id", + "type": "bigint", + "comment": "Foreign key to linktarget.lt_id", + "options": { "notnull": true, "unsigned": true } + } + ], + "indexes": [ + { + "name": "tl_namespace", + "columns": [ "tl_namespace", "tl_title", "tl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "tl_backlinks_namespace", + "columns": [ "tl_from_namespace", "tl_namespace", "tl_title", "tl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + }, + { + "name": "tl_target_id", + "columns": [ "tl_target_id", "tl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "tl_backlinks_namespace_target_id", + "columns": [ "tl_from_namespace", "tl_target_id", "tl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + } + ], + "pk": [ "tl_from", "tl_target_id" ] + }, + "after": { + "name": "templatelinks", + "comment": "Track template inclusions. The target page may or may not exist, and due to renames and deletions may refer to different page records as time goes by.", + "columns": [ + { + "name": "tl_from", + "comment": "Key to the page_id of the page containing the link.", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "tl_from_namespace", + "type": "integer", + "comment": "Namespace for this page", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "tl_target_id", + "type": "bigint", + "comment": "Foreign key to linktarget.lt_id", + "options": { "notnull": true, "unsigned": true } + } + ], + "indexes": [ + { + "name": "tl_target_id", + "columns": [ "tl_target_id", "tl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "tl_backlinks_namespace_target_id", + "columns": [ "tl_from_namespace", "tl_target_id", "tl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + } + ], + "pk": [ "tl_from", "tl_target_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-templatelinks-target_id.json b/sql/abstractSchemaChanges/patch-templatelinks-target_id.json new file mode 100644 index 000000000000..e7ff8acf69e1 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-templatelinks-target_id.json @@ -0,0 +1,107 @@ +{ + "comment": "Add tl_target_id on templatelinks (T299418)", + "before": { + "name": "templatelinks", + "comment": "Track template inclusions. The target page may or may not exist, and due to renames and deletions may refer to different page records as time goes by.", + "columns": [ + { + "name": "tl_from", + "comment": "Key to the page_id of the page containing the link.", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "tl_from_namespace", + "type": "integer", + "comment": "Namespace for this page", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "tl_namespace", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "tl_title", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + } + ], + "indexes": [ + { + "name": "tl_namespace", + "columns": [ "tl_namespace", "tl_title", "tl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "tl_backlinks_namespace", + "columns": [ "tl_from_namespace", "tl_namespace", "tl_title", "tl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + } + ], + "pk": [ "tl_from", "tl_namespace", "tl_title" ] + }, + "after": { + "name": "templatelinks", + "comment": "Track template inclusions. The target page may or may not exist, and due to renames and deletions may refer to different page records as time goes by.", + "columns": [ + { + "name": "tl_from", + "comment": "Key to the page_id of the page containing the link.", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "tl_from_namespace", + "type": "integer", + "comment": "Namespace for this page", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "tl_namespace", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "tl_title", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "tl_target_id", + "type": "bigint", + "comment": "Foreign key to linktarget.lt_id", + "options": { "notnull": false, "unsigned": true, "default": null } + } + ], + "indexes": [ + { + "name": "tl_namespace", + "columns": [ "tl_namespace", "tl_title", "tl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "tl_backlinks_namespace", + "columns": [ "tl_from_namespace", "tl_namespace", "tl_title", "tl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + }, + { + "name": "tl_target_id", + "columns": [ "tl_target_id", "tl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "tl_backlinks_namespace_target_id", + "columns": [ "tl_from_namespace", "tl_target_id", "tl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + } + ], + "pk": [ "tl_from", "tl_namespace", "tl_title" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-templatelinks-tl_title-nullable.json b/sql/abstractSchemaChanges/patch-templatelinks-tl_title-nullable.json new file mode 100644 index 000000000000..bfbbe7c2aca1 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-templatelinks-tl_title-nullable.json @@ -0,0 +1,125 @@ +{ + "comment": "Changing the primary key as part of normalizing templatelinks (T306674)", + "before": { + "name": "templatelinks", + "comment": "Track template inclusions. The target page may or may not exist, and due to renames and deletions may refer to different page records as time goes by.", + "columns": [ + { + "name": "tl_from", + "comment": "Key to the page_id of the page containing the link.", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "tl_from_namespace", + "type": "integer", + "comment": "Namespace for this page", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "tl_namespace", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "tl_title", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "tl_target_id", + "type": "bigint", + "comment": "Foreign key to linktarget.lt_id", + "options": { "notnull": false, "unsigned": true, "default": null } + } + ], + "indexes": [ + { + "name": "tl_namespace", + "columns": [ "tl_namespace", "tl_title", "tl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "tl_backlinks_namespace", + "columns": [ "tl_from_namespace", "tl_namespace", "tl_title", "tl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + }, + { + "name": "tl_target_id", + "columns": [ "tl_target_id", "tl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "tl_backlinks_namespace_target_id", + "columns": [ "tl_from_namespace", "tl_target_id", "tl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + } + ], + "pk": [ "tl_from", "tl_namespace", "tl_title" ] + }, + "after": { + "name": "templatelinks", + "comment": "Track template inclusions. The target page may or may not exist, and due to renames and deletions may refer to different page records as time goes by.", + "columns": [ + { + "name": "tl_from", + "comment": "Key to the page_id of the page containing the link.", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "tl_from_namespace", + "type": "integer", + "comment": "Namespace for this page", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "tl_namespace", + "type": "integer", + "options": { "default": 0 } + }, + { + "name": "tl_title", + "type": "binary", + "options": { "length": 255, "default": "" } + }, + { + "name": "tl_target_id", + "type": "bigint", + "comment": "Foreign key to linktarget.lt_id", + "options": { "notnull": true, "unsigned": true } + } + ], + "indexes": [ + { + "name": "tl_namespace", + "columns": [ "tl_namespace", "tl_title", "tl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "tl_backlinks_namespace", + "columns": [ "tl_from_namespace", "tl_namespace", "tl_title", "tl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + }, + { + "name": "tl_target_id", + "columns": [ "tl_target_id", "tl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "tl_backlinks_namespace_target_id", + "columns": [ "tl_from_namespace", "tl_target_id", "tl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + } + ], + "pk": [ "tl_from", "tl_target_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-uploadstash-us_size_to_bigint.json b/sql/abstractSchemaChanges/patch-uploadstash-us_size_to_bigint.json new file mode 100644 index 000000000000..59aea9705da8 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-uploadstash-us_size_to_bigint.json @@ -0,0 +1,375 @@ +{ + "comment": "Increaes us_size to bigint (T191805)", + "before": + { + "name": "uploadstash", + "comment": "Store information about newly uploaded files before they're moved into the actual filestore", + "columns": [ + { + "name": "us_id", + "type": "integer", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "us_user", + "comment": "the user who uploaded the file.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "us_key", + "comment": "file key. this is how applications actually search for the file. this might go away, or become the primary key.", + "type": "string", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "us_orig_path", + "comment": "the original path", + "type": "string", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "us_path", + "comment": "the temporary path at which the file is actually stored", + "type": "string", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "us_source_type", + "comment": "which type of upload the file came from (sometimes)", + "type": "string", + "options": { + "notnull": false, + "length": 50 + } + }, + { + "name": "us_timestamp", + "comment": "the date/time on which the file was added", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "us_status", + "type": "string", + "options": { + "notnull": true, + "length": 50 + } + }, + { + "name": "us_chunk_inx", + "comment": "chunk counter starts at 0, current offset is stored in us_size", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false + } + }, + { + "name": "us_props", + "comment": "Serialized file properties from FSFile::getProps()", + "type": "blob", + "options": { + "notnull": false, + "length": 65530 + } + }, + { + "name": "us_size", + "comment": "file size in bytes", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "us_sha1", + "comment": "this hash comes from FSFile::getSha1Base36(), and is 31 characters", + "type": "string", + "options": { + "notnull": true, + "length": 31 + } + }, + { + "name": "us_mime", + "type": "string", + "options": { + "notnull": false, + "length": 255 + } + }, + { + "name": "us_media_type", + "comment": "Media type as defined by the MEDIATYPE_xxx constants, should duplicate definition in the image table", + "type": "mwenum", + "options": { "notnull": false, "default": null, + "fixed": true, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "us_image_width", + "comment": "image-specific properties", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false + } + }, + { + "name": "us_image_height", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false + } + }, + { + "name": "us_image_bits", + "type": "smallint", + "options": { + "unsigned": true, + "notnull": false + } + } + ], + "indexes": [ + { + "name": "us_user", + "comment": "sometimes there's a delete for all of a user's stuff.", + "columns": [ + "us_user" + ], + "unique": false + }, + { + "name": "us_key", + "comment": "pick out files by key, enforce key uniqueness", + "columns": [ + "us_key" + ], + "unique": true + }, + { + "name": "us_timestamp", + "comment": "the abandoned upload cleanup script needs this", + "columns": [ + "us_timestamp" + ], + "unique": false + } + ], + "pk": [ + "us_id" + ] + }, + "after": + { + "name": "uploadstash", + "comment": "Store information about newly uploaded files before they're moved into the actual filestore", + "columns": [ + { + "name": "us_id", + "type": "integer", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "us_user", + "comment": "the user who uploaded the file.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "us_key", + "comment": "file key. this is how applications actually search for the file. this might go away, or become the primary key.", + "type": "string", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "us_orig_path", + "comment": "the original path", + "type": "string", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "us_path", + "comment": "the temporary path at which the file is actually stored", + "type": "string", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "us_source_type", + "comment": "which type of upload the file came from (sometimes)", + "type": "string", + "options": { + "notnull": false, + "length": 50 + } + }, + { + "name": "us_timestamp", + "comment": "the date/time on which the file was added", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "us_status", + "type": "string", + "options": { + "notnull": true, + "length": 50 + } + }, + { + "name": "us_chunk_inx", + "comment": "chunk counter starts at 0, current offset is stored in us_size", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false + } + }, + { + "name": "us_props", + "comment": "Serialized file properties from FSFile::getProps()", + "type": "blob", + "options": { + "notnull": false, + "length": 65530 + } + }, + { + "name": "us_size", + "comment": "file size in bytes", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "us_sha1", + "comment": "this hash comes from FSFile::getSha1Base36(), and is 31 characters", + "type": "string", + "options": { + "notnull": true, + "length": 31 + } + }, + { + "name": "us_mime", + "type": "string", + "options": { + "notnull": false, + "length": 255 + } + }, + { + "name": "us_media_type", + "comment": "Media type as defined by the MEDIATYPE_xxx constants, should duplicate definition in the image table", + "type": "mwenum", + "options": { "notnull": false, "default": null, + "fixed": true, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "us_image_width", + "comment": "image-specific properties", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false + } + }, + { + "name": "us_image_height", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false + } + }, + { + "name": "us_image_bits", + "type": "smallint", + "options": { + "unsigned": true, + "notnull": false + } + } + ], + "indexes": [ + { + "name": "us_user", + "comment": "sometimes there's a delete for all of a user's stuff.", + "columns": [ + "us_user" + ], + "unique": false + }, + { + "name": "us_key", + "comment": "pick out files by key, enforce key uniqueness", + "columns": [ + "us_key" + ], + "unique": true + }, + { + "name": "us_timestamp", + "comment": "the abandoned upload cleanup script needs this", + "columns": [ + "us_timestamp" + ], + "unique": false + } + ], + "pk": [ + "us_id" + ] + } +} diff --git a/sql/abstractSchemaChanges/patch-user-user_editcount.json b/sql/abstractSchemaChanges/patch-user-user_editcount.json new file mode 100644 index 000000000000..6a1271404c40 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-user-user_editcount.json @@ -0,0 +1,175 @@ +{ + "comment": "Set user_editcount to unsigned in user table", + "before": { + "name": "user", + "columns": [ + { + "name": "user_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "user_name", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "user_real_name", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "user_password", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_newpassword", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_newpass_time", + "type": "binary", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_email", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_touched", + "type": "binary", + "options": { "notnull": true, "length": 14 } + }, + { + "name": "user_token", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32, "fixed": true } + }, + { + "name": "user_email_authenticated", + "type": "binary", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_email_token", + "type": "binary", + "options": { "notnull": false, "length": 32, "fixed": true } + }, + { + "name": "user_email_token_expires", + "type": "binary", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_registration", + "type": "binary", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_editcount", + "type": "integer", + "options": { "notnull": false } + }, + { + "name": "user_password_expires", + "type": "binary", + "options": { "notnull": false, "length": 14 } + } + ], + "indexes": [ + { "name": "user_name", "columns": [ "user_name" ], "unique": true }, + { "name": "user_email_token", "columns": [ "user_email_token" ], "unique": false }, + { "name": "user_email", "columns": [ "user_email" ], "unique": false, "options": { "lengths": [ 50, null, null ] } } + ], + "pk": [ "user_id" ] + }, + "after": { + "name": "user", + "columns": [ + { + "name": "user_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "user_name", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "user_real_name", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "user_password", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_newpassword", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_newpass_time", + "type": "binary", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_email", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_touched", + "type": "binary", + "options": { "notnull": true, "length": 14 } + }, + { + "name": "user_token", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32, "fixed": true } + }, + { + "name": "user_email_authenticated", + "type": "binary", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_email_token", + "type": "binary", + "options": { "notnull": false, "length": 32, "fixed": true } + }, + { + "name": "user_email_token_expires", + "type": "binary", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_registration", + "type": "binary", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_editcount", + "type": "integer", + "options": { "notnull": false, "unsigned": true } + }, + { + "name": "user_password_expires", + "type": "binary", + "options": { "notnull": false, "length": 14 } + } + ], + "indexes": [ + { "name": "user_name", "columns": [ "user_name" ], "unique": true }, + { "name": "user_email_token", "columns": [ "user_email_token" ], "unique": false }, + { "name": "user_email", "columns": [ "user_email" ], "unique": false, "options": { "lengths": [ 50, null, null ] } } + ], + "pk": [ "user_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-user-user_is_temp.json b/sql/abstractSchemaChanges/patch-user-user_is_temp.json new file mode 100644 index 000000000000..14e40e656c25 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-user-user_is_temp.json @@ -0,0 +1,225 @@ +{ + "comment": "Add user_is_temp to user table", + "before": { + "name": "user", + "comment": "The user table contains basic account information, authentication keys, etc. Some multi-wiki sites may share a single central user table between separate wikis using the $wgSharedDB setting. Note that even when an external authentication plugin is in use, user table entries still need to be created to store preferences and to key tracking information in the other tables", + "columns": [ + { + "name": "user_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "user_name", + "comment": "Usernames must be unique, must not be in the form of an IP address. They should not allow slashes or case conflicts. Spaces are allowed, and are not converted to underscores like in page titles.", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "user_real_name", + "comment": "Optional 'real name' to be displayed in credit listings", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "user_password", + "comment": "Password hashes", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_newpassword", + "comment": "When using 'mail me a new password', a random password is generated and the hash stored here. The previous password is left in place until someone actually logs in with the new password, at which point the hash is moved to user_password and the old password is invalidated.", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_newpass_time", + "comment": "Timestamp of the last time when a new password was sent, for throttling and expiring purposes. Emailed passwords will expire $wgNewPasswordExpiry (a week) after being set. If user_newpass_time is NULL (eg. created by mail) it doesn't expire.", + "type": "mwtimestamp", + "options": { "notnull": false } + }, + { + "name": "user_email", + "comment": "User email. Non public info.", + "type": "text", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_touched", + "comment": "If the browser sends an If-Modified-Since header, a 304 response is suppressed if the value in this field for the current user is later than the value in the IMS header. That is, this field is an invalidation timestamp for the browser cache of logged-in users. Among other things, it is used to prevent pages generated for a previously logged in user from being displayed after a session expiry followed by a fresh login.", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "user_token", + "comment": "A pseudorandomly generated value that is stored in a cookie when the 'remember password' feature is used (previously, a hash of the password was used, but this was vulnerable to cookie-stealing attacks)", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32, "fixed": true } + }, + { + "name": "user_email_authenticated", + "comment": "Initially NULL; when a user's e-mail address has been validated by returning with a mailed token, this is set to the current timestamp.", + "type": "mwtimestamp", + "options": { "notnull": false } + }, + { + "name": "user_email_token", + "comment": "Randomly generated token created when the e-mail address is set and a confirmation test mail sent.", + "type": "binary", + "options": { "notnull": false, "length": 32, "fixed": true } + }, + { + "name": "user_email_token_expires", + "comment": "Expiration date for the user_email_token.", + "type": "mwtimestamp", + "options": { "notnull": false } + }, + { + "name": "user_registration", + "comment": "Timestamp of account registration. Accounts predating this schema addition may contain NULL.", + "type": "mwtimestamp", + "options": { "notnull": false } + }, + { + "name": "user_editcount", + "comment": "Count of edits and edit-like actions. Not intended to be an accurate copy of 'COUNT(*) WHERE rev_actor refers to a user's actor_id'. May contain NULL for old accounts if batch-update scripts haven't been run, as well as listing deleted edits and other myriad ways it could be out of sync. Meant primarily for heuristic checks to give an impression of whether the account has been used much.", + "type": "integer", + "options": { "notnull": false, "unsigned": true } + }, + { + "name": "user_password_expires", + "comment": "Expiration date for user password.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + } + ], + "indexes": [ + { "name": "user_name", "columns": [ "user_name" ], "unique": true }, + { "name": "user_email_token", "columns": [ "user_email_token" ], "unique": false }, + { "name": "user_email", "columns": [ "user_email" ], "unique": false, "options": { "lengths": [ 50, null, null ] } } + ], + "pk": [ "user_id" ] + }, + "after": { + "name": "user", + "comment": "The user table contains basic account information, authentication keys, etc. Some multi-wiki sites may share a single central user table between separate wikis using the $wgSharedDB setting. Note that even when an external authentication plugin is in use, user table entries still need to be created to store preferences and to key tracking information in the other tables", + "columns": [ + { + "name": "user_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "user_name", + "comment": "Usernames must be unique, must not be in the form of an IP address. They should not allow slashes or case conflicts. Spaces are allowed, and are not converted to underscores like in page titles.", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "user_real_name", + "comment": "Optional 'real name' to be displayed in credit listings", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "user_password", + "comment": "Password hashes", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_newpassword", + "comment": "When using 'mail me a new password', a random password is generated and the hash stored here. The previous password is left in place until someone actually logs in with the new password, at which point the hash is moved to user_password and the old password is invalidated.", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_newpass_time", + "comment": "Timestamp of the last time when a new password was sent, for throttling and expiring purposes. Emailed passwords will expire $wgNewPasswordExpiry (a week) after being set. If user_newpass_time is NULL (eg. created by mail) it doesn't expire.", + "type": "mwtimestamp", + "options": { "notnull": false } + }, + { + "name": "user_email", + "comment": "User email. Non public info.", + "type": "text", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_touched", + "comment": "If the browser sends an If-Modified-Since header, a 304 response is suppressed if the value in this field for the current user is later than the value in the IMS header. That is, this field is an invalidation timestamp for the browser cache of logged-in users. Among other things, it is used to prevent pages generated for a previously logged in user from being displayed after a session expiry followed by a fresh login.", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "user_token", + "comment": "A pseudorandomly generated value that is stored in a cookie when the 'remember password' feature is used (previously, a hash of the password was used, but this was vulnerable to cookie-stealing attacks)", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32, "fixed": true } + }, + { + "name": "user_email_authenticated", + "comment": "Initially NULL; when a user's e-mail address has been validated by returning with a mailed token, this is set to the current timestamp.", + "type": "mwtimestamp", + "options": { "notnull": false } + }, + { + "name": "user_email_token", + "comment": "Randomly generated token created when the e-mail address is set and a confirmation test mail sent.", + "type": "binary", + "options": { "notnull": false, "length": 32, "fixed": true } + }, + { + "name": "user_email_token_expires", + "comment": "Expiration date for the user_email_token.", + "type": "mwtimestamp", + "options": { "notnull": false } + }, + { + "name": "user_registration", + "comment": "Timestamp of account registration. Accounts predating this schema addition may contain NULL.", + "type": "mwtimestamp", + "options": { "notnull": false } + }, + { + "name": "user_editcount", + "comment": "Count of edits and edit-like actions. Not intended to be an accurate copy of 'COUNT(*) WHERE rev_actor refers to a user's actor_id'. May contain NULL for old accounts if batch-update scripts haven't been run, as well as listing deleted edits and other myriad ways it could be out of sync. Meant primarily for heuristic checks to give an impression of whether the account has been used much.", + "type": "integer", + "options": { "notnull": false, "unsigned": true } + }, + { + "name": "user_password_expires", + "comment": "Expiration date for user password.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + }, + { + "name": "user_is_temp", + "comment": "A boolean value representing whether the user is a temporary user. False if any type of user other than a temporary user. This exists to allow temporary users to be identified from the database only, by external applications.", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + } + ], + "indexes": [ + { "name": "user_name", "columns": [ "user_name" ], "unique": true }, + { "name": "user_email_token", "columns": [ "user_email_token" ], "unique": false }, + { "name": "user_email", "columns": [ "user_email" ], "unique": false, "options": { "lengths": [ 50, null, null ] } } + ], + "pk": [ "user_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-user_autocreate_serial-uas_year.json b/sql/abstractSchemaChanges/patch-user_autocreate_serial-uas_year.json new file mode 100644 index 000000000000..734f1969808a --- /dev/null +++ b/sql/abstractSchemaChanges/patch-user_autocreate_serial-uas_year.json @@ -0,0 +1,49 @@ +{ + "comment": "Add uas_year to user_autocreate_serial table", + "before": { + "name": "user_autocreate_serial", + "comment": "Table for sequential name generation for auto-created temporary users", + "columns": [ + { + "name": "uas_shard", + "comment": "The segment of ID space, ID mod N, referred to by this row", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "uas_value", + "comment": "The maximum allocated ID value", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + } + ], + "indexes": [], + "pk": [ "uas_shard" ] + }, + "after": { + "name": "user_autocreate_serial", + "comment": "Table for sequential name generation for auto-created temporary users", + "columns": [ + { + "name": "uas_shard", + "comment": "The segment of ID space, ID mod N, referred to by this row", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "uas_year", + "comment": "The year to which this row belongs, if $wgAutoCreateTempUser['serialProvider']['useYear'] is true.", + "type": "smallint", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "uas_value", + "comment": "The maximum allocated ID value", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + } + ], + "indexes": [], + "pk": [ "uas_shard", "uas_year" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-user_properties-rename-index.json b/sql/abstractSchemaChanges/patch-user_properties-rename-index.json new file mode 100644 index 000000000000..8d0904b6e6ee --- /dev/null +++ b/sql/abstractSchemaChanges/patch-user_properties-rename-index.json @@ -0,0 +1,59 @@ +{ + "comment": "Rename user_properties_property index to up_property (T270033)", + "before": { + "name": "user_properties", + "comment": "User preferences and perhaps other fun stuff. :) Replaces the old user.user_options blob, with a couple nice properties: 1) We only store non-default settings, so changes to the defaults are now reflected for everybody, not just new accounts. 2) We can more easily do bulk lookups, statistics, or modifications of saved options since it's a sensible table structure.", + "columns": [ + { + "name": "up_user", + "comment": "Foreign key to user.user_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "up_property", + "comment": "Name of the option being saved. This is indexed for bulk lookup.", + "type": "binary", + "options": { "length": 255, "notnull": true } + }, + { + "name": "up_value", + "comment": "Property value as a string.", + "type": "blob", + "options": { "length": 65530, "notnull": false } + } + ], + "indexes": [ + { "name": "user_properties_property", "columns": [ "up_property" ], "unique": false } + ], + "pk": [ "up_user", "up_property" ] + }, + "after": { + "name": "user_properties", + "comment": "User preferences and perhaps other fun stuff. :) Replaces the old user.user_options blob, with a couple nice properties: 1) We only store non-default settings, so changes to the defaults are now reflected for everybody, not just new accounts. 2) We can more easily do bulk lookups, statistics, or modifications of saved options since it's a sensible table structure.", + "columns": [ + { + "name": "up_user", + "comment": "Foreign key to user.user_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "up_property", + "comment": "Name of the option being saved. This is indexed for bulk lookup.", + "type": "binary", + "options": { "length": 255, "notnull": true } + }, + { + "name": "up_value", + "comment": "Property value as a string.", + "type": "blob", + "options": { "length": 65530, "notnull": false } + } + ], + "indexes": [ + { "name": "up_property", "columns": [ "up_property" ], "unique": false } + ], + "pk": [ "up_user", "up_property" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-user_table-updates.json b/sql/abstractSchemaChanges/patch-user_table-updates.json new file mode 100644 index 000000000000..08c8421084eb --- /dev/null +++ b/sql/abstractSchemaChanges/patch-user_table-updates.json @@ -0,0 +1,217 @@ +{ + "comment": "Update `user_name` and `user_real_name` from varchar to varbinary(255). Drop empty string default (invalid timestamp value) from `user_touched`.", + "before": { + "name": "user", + "comment": "The user table contains basic account information, authentication keys, etc. Some multi-wiki sites may share a single central user table between separate wikis using the $wgSharedDB setting. Note that even when an external authentication plugin is in use, user table entries still need to be created to store preferences and to key tracking information in the other tables", + "columns": [ + { + "name": "user_id", + "comment": "Unique identifier number. The page_id will be preserved across edits and rename operations, but not deletions and recreations.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "user_name", + "comment": "Usernames must be unique, must not be in the form of an IP address. They should not allow slashes or case conflicts. Spaces are allowed, and are not converted to underscores like in page titles.", + "type": "string", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "user_real_name", + "comment": "Optional 'real name' to be displayed in credit listings", + "type": "string", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "user_password", + "comment": "Password hashes", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_newpassword", + "comment": "When using 'mail me a new password', a random password is generated and the hash stored here. The previous password is left in place until someone actually logs in with the new password, at which point the hash is moved to user_password and the old password is invalidated.", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_newpass_time", + "comment": "Timestamp of the last time when a new password was sent, for throttling and expiring purposes. Emailed passwords will expire $wgNewPasswordExpiry (a week) after being set. If user_newpass_time is NULL (eg. created by mail) it doesn't expire.", + "type": "mwtimestamp", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_email", + "comment": "User email. Non public info.", + "type": "text", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_touched", + "comment": "If the browser sends an If-Modified-Since header, a 304 response is suppressed if the value in this field for the current user is later than the value in the IMS header. That is, this field is an invalidation timestamp for the browser cache of logged-in users. Among other things, it is used to prevent pages generated for a previously logged in user from being displayed after a session expiry followed by a fresh login.", + "type": "mwtimestamp", + "options": { "notnull": true, "length": 14, "default": "" } + }, + { + "name": "user_token", + "comment": "A pseudorandomly generated value that is stored in a cookie when the 'remember password' feature is used (previously, a hash of the password was used, but this was vulnerable to cookie-stealing attacks)", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32, "fixed": true } + }, + { + "name": "user_email_authenticated", + "comment": "Initially NULL; when a user's e-mail address has been validated by returning with a mailed token, this is set to the current timestamp.", + "type": "mwtimestamp", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_email_token", + "comment": "Randomly generated token created when the e-mail address is set and a confirmation test mail sent.", + "type": "binary", + "options": { "notnull": false, "length": 32, "fixed": true } + }, + { + "name": "user_email_token_expires", + "comment": "Expiration date for the user_email_token.", + "type": "mwtimestamp", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_registration", + "comment": "Timestamp of account registration. Accounts predating this schema addition may contain NULL.", + "type": "mwtimestamp", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_editcount", + "comment": "Count of edits and edit-like actions. Not intended to be an accurate copy of 'COUNT(*) WHERE rev_actor refers to a user's actor_id'. May contain NULL for old accounts if batch-update scripts haven't been run, as well as listing deleted edits and other myriad ways it could be out of sync.Meant primarily for heuristic checks to give an impression of whether the account has been used much.", + "type": "integer", + "options": { "notnull": false } + }, + { + "name": "user_password_expires", + "comment": "Expiration date for user password.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + } + ], + "indexes": [ + { "name": "user_name", "columns": [ "user_name" ], "unique": true }, + { "name": "user_email_token", "columns": [ "user_email_token" ], "unique": false }, + { "name": "user_email", "columns": [ "user_email" ], "unique": false, "options": { "lengths": [ 50, null, null ] } } + ], + "pk": [ "user_id" ] + }, + "after": { + "name": "user", + "comment": "The user table contains basic account information, authentication keys, etc. Some multi-wiki sites may share a single central user table between separate wikis using the $wgSharedDB setting. Note that even when an external authentication plugin is in use, user table entries still need to be created to store preferences and to key tracking information in the other tables", + "columns": [ + { + "name": "user_id", + "comment": "Unique identifier number. The page_id will be preserved across edits and rename operations, but not deletions and recreations.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "user_name", + "comment": "Usernames must be unique, must not be in the form of an IP address. They should not allow slashes or case conflicts. Spaces are allowed, and are not converted to underscores like in page titles.", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "user_real_name", + "comment": "Optional 'real name' to be displayed in credit listings", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "user_password", + "comment": "Password hashes", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_newpassword", + "comment": "When using 'mail me a new password', a random password is generated and the hash stored here. The previous password is left in place until someone actually logs in with the new password, at which point the hash is moved to user_password and the old password is invalidated.", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_newpass_time", + "comment": "Timestamp of the last time when a new password was sent, for throttling and expiring purposes. Emailed passwords will expire $wgNewPasswordExpiry (a week) after being set. If user_newpass_time is NULL (eg. created by mail) it doesn't expire.", + "type": "mwtimestamp", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_email", + "comment": "User email. Non public info.", + "type": "text", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_touched", + "comment": "If the browser sends an If-Modified-Since header, a 304 response is suppressed if the value in this field for the current user is later than the value in the IMS header. That is, this field is an invalidation timestamp for the browser cache of logged-in users. Among other things, it is used to prevent pages generated for a previously logged in user from being displayed after a session expiry followed by a fresh login.", + "type": "mwtimestamp", + "options": { "notnull": true, "length": 14 } + }, + { + "name": "user_token", + "comment": "A pseudorandomly generated value that is stored in a cookie when the 'remember password' feature is used (previously, a hash of the password was used, but this was vulnerable to cookie-stealing attacks)", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32, "fixed": true } + }, + { + "name": "user_email_authenticated", + "comment": "Initially NULL; when a user's e-mail address has been validated by returning with a mailed token, this is set to the current timestamp.", + "type": "mwtimestamp", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_email_token", + "comment": "Randomly generated token created when the e-mail address is set and a confirmation test mail sent.", + "type": "binary", + "options": { "notnull": false, "length": 32, "fixed": true } + }, + { + "name": "user_email_token_expires", + "comment": "Expiration date for the user_email_token.", + "type": "mwtimestamp", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_registration", + "comment": "Timestamp of account registration. Accounts predating this schema addition may contain NULL.", + "type": "mwtimestamp", + "options": { "notnull": false, "length": 14 } + }, + { + "name": "user_editcount", + "comment": "Count of edits and edit-like actions. Not intended to be an accurate copy of 'COUNT(*) WHERE rev_actor refers to a user's actor_id'. May contain NULL for old accounts if batch-update scripts haven't been run, as well as listing deleted edits and other myriad ways it could be out of sync.Meant primarily for heuristic checks to give an impression of whether the account has been used much.", + "type": "integer", + "options": { "notnull": false } + }, + { + "name": "user_password_expires", + "comment": "Expiration date for user password.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + } + ], + "indexes": [ + { "name": "user_name", "columns": [ "user_name" ], "unique": true }, + { "name": "user_email_token", "columns": [ "user_email_token" ], "unique": false }, + { "name": "user_email", "columns": [ "user_email" ], "unique": false, "options": { "lengths": [ 50, null, null ] } } + ], + "pk": [ "user_id" ] + } +} diff --git a/sql/abstractSchemaChanges/patch-watchlist-namespace_title-rename-index.json b/sql/abstractSchemaChanges/patch-watchlist-namespace_title-rename-index.json new file mode 100644 index 000000000000..2a29e5767344 --- /dev/null +++ b/sql/abstractSchemaChanges/patch-watchlist-namespace_title-rename-index.json @@ -0,0 +1,107 @@ +{ + "comment": "Rename namespace_title index to wl_namespace_title on watchlist (T266228)", + "before": { + "name": "watchlist", + "columns": [ + { + "name": "wl_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "wl_user", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "wl_namespace", + "type": "integer", + "options": { "notnull": true, "unsigned": false, "default": 0 } + }, + { + "name": "wl_title", + "type": "binary", + "options": { "length": 255, "notnull": true, "default": "" } + }, + { + "name": "wl_notificationtimestamp", + "comment": "Timestamp used to send notification e-mails and show 'updated since last visit' markers. Set to NULL when the user visits the latest revision of the page, which means that they should be sent an e-mail on the next change.", + "type": "mwtimestamp", + "options": { "notnull": false } + } + ], + "indexes": [ + { + "name": "wl_user", + "columns": [ "wl_user", "wl_namespace", "wl_title" ], + "comment": "Special:Watchlist", + "unique": true + }, + { + "name": "namespace_title", + "columns": [ "wl_namespace", "wl_title" ], + "comment": "Special:Movepage (WatchedItemStore::duplicateEntry)", + "unique": false + }, + { + "name": "wl_user_notificationtimestamp", + "columns": [ "wl_user", "wl_notificationtimestamp" ], + "comment": "ApiQueryWatchlistRaw changed filter", + "unique": false + } + ], + "pk": [ "wl_id" ] + }, + "after": { + "name": "watchlist", + "columns": [ + { + "name": "wl_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "wl_user", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "wl_namespace", + "type": "integer", + "options": { "notnull": true, "unsigned": false, "default": 0 } + }, + { + "name": "wl_title", + "type": "binary", + "options": { "length": 255, "notnull": true, "default": "" } + }, + { + "name": "wl_notificationtimestamp", + "comment": "Timestamp used to send notification e-mails and show 'updated since last visit' markers. Set to NULL when the user visits the latest revision of the page, which means that they should be sent an e-mail on the next change.", + "type": "mwtimestamp", + "options": { "notnull": false } + } + ], + "indexes": [ + { + "name": "wl_user", + "columns": [ "wl_user", "wl_namespace", "wl_title" ], + "comment": "Special:Watchlist", + "unique": true + }, + { + "name": "wl_namespace_title", + "columns": [ "wl_namespace", "wl_title" ], + "comment": "Special:Movepage (WatchedItemStore::duplicateEntry)", + "unique": false + }, + { + "name": "wl_user_notificationtimestamp", + "columns": [ "wl_user", "wl_notificationtimestamp" ], + "comment": "ApiQueryWatchlistRaw changed filter", + "unique": false + } + ], + "pk": [ "wl_id" ] + } +} diff --git a/sql/mysql/patch-archive-ar_title-varbinary.sql b/sql/mysql/patch-archive-ar_title-varbinary.sql new file mode 100644 index 000000000000..531c0d1c970d --- /dev/null +++ b/sql/mysql/patch-archive-ar_title-varbinary.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/archive + MODIFY ar_title VARBINARY(255) DEFAULT '' NOT NULL; diff --git a/sql/mysql/patch-archive-rename-name_title_timestamp-index.sql b/sql/mysql/patch-archive-rename-name_title_timestamp-index.sql new file mode 100644 index 000000000000..21d5a7fa7843 --- /dev/null +++ b/sql/mysql/patch-archive-rename-name_title_timestamp-index.sql @@ -0,0 +1,2 @@ +DROP INDEX name_title_timestamp ON /*_*/archive; +CREATE INDEX ar_name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp); diff --git a/sql/mysql/patch-block_target.sql b/sql/mysql/patch-block_target.sql new file mode 100644 index 000000000000..f4351d32bc78 --- /dev/null +++ b/sql/mysql/patch-block_target.sql @@ -0,0 +1,48 @@ + +CREATE TABLE /*_*/block ( + bl_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + bl_target INT UNSIGNED NOT NULL, + bl_by_actor BIGINT UNSIGNED NOT NULL, + bl_reason_id BIGINT UNSIGNED NOT NULL, + bl_timestamp BINARY(14) NOT NULL, + bl_anon_only TINYINT(1) DEFAULT 0 NOT NULL, + bl_create_account TINYINT(1) DEFAULT 1 NOT NULL, + bl_enable_autoblock TINYINT(1) DEFAULT 1 NOT NULL, + bl_expiry VARBINARY(14) NOT NULL, + bl_deleted TINYINT(1) DEFAULT 0 NOT NULL, + bl_block_email TINYINT(1) DEFAULT 0 NOT NULL, + bl_allow_usertalk TINYINT(1) DEFAULT 0 NOT NULL, + bl_parent_block_id INT UNSIGNED DEFAULT NULL, + bl_sitewide TINYINT(1) DEFAULT 1 NOT NULL, + INDEX bl_timestamp (bl_timestamp), + INDEX bl_target (bl_target), + INDEX bl_expiry (bl_expiry), + INDEX bl_parent_block_id (bl_parent_block_id), + PRIMARY KEY(bl_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/block_target ( + bt_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + bt_address TINYBLOB DEFAULT NULL, + bt_user INT UNSIGNED DEFAULT NULL, + bt_user_text VARBINARY(255) DEFAULT NULL, + bt_auto TINYINT(1) DEFAULT 0 NOT NULL, + bt_range_start TINYBLOB DEFAULT NULL, + bt_range_end TINYBLOB DEFAULT NULL, + bt_ip_hex TINYBLOB DEFAULT NULL, + bt_count INT DEFAULT 0 NOT NULL, + INDEX bt_address ( + bt_address(42) + ), + INDEX bt_ip_user_text ( + bt_ip_hex(35), + bt_user_text(255) + ), + INDEX bt_range ( + bt_range_start(35), + bt_range_end(35) + ), + INDEX bt_user (bt_user), + PRIMARY KEY(bt_id) +) /*$wgDBTableOptions*/; diff --git a/sql/mysql/patch-category-cat_title-varbinary.sql b/sql/mysql/patch-category-cat_title-varbinary.sql new file mode 100644 index 000000000000..6f0673056b18 --- /dev/null +++ b/sql/mysql/patch-category-cat_title-varbinary.sql @@ -0,0 +1 @@ +ALTER TABLE /*_*/category MODIFY cat_title VARBINARY(255) NOT NULL; diff --git a/sql/mysql/patch-categorylinks-cl_to-varbinary.sql b/sql/mysql/patch-categorylinks-cl_to-varbinary.sql new file mode 100644 index 000000000000..fb60c5d6d651 --- /dev/null +++ b/sql/mysql/patch-categorylinks-cl_to-varbinary.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/categorylinks MODIFY cl_to VARBINARY(255) DEFAULT '' NOT NULL; +ALTER TABLE /*_*/categorylinks MODIFY cl_sortkey_prefix VARBINARY(255) DEFAULT '' NOT NULL; diff --git a/sql/mysql/patch-change_tag-ct_rc_id.sql b/sql/mysql/patch-change_tag-ct_rc_id.sql new file mode 100644 index 000000000000..80fe84e4fc9a --- /dev/null +++ b/sql/mysql/patch-change_tag-ct_rc_id.sql @@ -0,0 +1,6 @@ +-- 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 +ALTER TABLE /*_*/change_tag +CHANGE ct_rc_id ct_rc_id BIGINT UNSIGNED DEFAULT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-change_tag-rename-indexes.sql b/sql/mysql/patch-change_tag-rename-indexes.sql new file mode 100644 index 000000000000..ef3cba025a15 --- /dev/null +++ b/sql/mysql/patch-change_tag-rename-indexes.sql @@ -0,0 +1,12 @@ +-- 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 ON /*_*/change_tag; +CREATE UNIQUE INDEX ct_rc_tag_id ON /*_*/change_tag (ct_rc_id, ct_tag_id); +DROP INDEX change_tag_log_tag_id ON /*_*/change_tag; +CREATE UNIQUE INDEX ct_log_tag_id ON /*_*/change_tag (ct_log_id, ct_tag_id); +DROP INDEX change_tag_rev_tag_id ON /*_*/change_tag; +CREATE UNIQUE INDEX ct_rev_tag_id ON /*_*/change_tag (ct_rev_id, ct_tag_id); +DROP INDEX change_tag_tag_id_id ON /*_*/change_tag; +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/mysql/patch-content_models-model_id.sql b/sql/mysql/patch-content_models-model_id.sql new file mode 100644 index 000000000000..4847a3edf3b2 --- /dev/null +++ b/sql/mysql/patch-content_models-model_id.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/content_models + MODIFY model_id INT AUTO_INCREMENT NOT NULL; diff --git a/sql/mysql/patch-drop-cl_collation_ext.sql b/sql/mysql/patch-drop-cl_collation_ext.sql new file mode 100644 index 000000000000..aebe7e917d0b --- /dev/null +++ b/sql/mysql/patch-drop-cl_collation_ext.sql @@ -0,0 +1,5 @@ +-- 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 +DROP INDEX cl_collation_ext ON /*_*/categorylinks; diff --git a/sql/mysql/patch-drop-page_restrictions-pr_user.sql b/sql/mysql/patch-drop-page_restrictions-pr_user.sql new file mode 100644 index 000000000000..1b630af6d01e --- /dev/null +++ b/sql/mysql/patch-drop-page_restrictions-pr_user.sql @@ -0,0 +1,6 @@ +-- 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 +ALTER TABLE /*_*/page_restrictions +DROP pr_user; diff --git a/sql/mysql/patch-drop-rev_page_id.sql b/sql/mysql/patch-drop-rev_page_id.sql new file mode 100644 index 000000000000..80975a881405 --- /dev/null +++ b/sql/mysql/patch-drop-rev_page_id.sql @@ -0,0 +1,5 @@ +-- 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 ON /*_*/revision;
\ No newline at end of file diff --git a/sql/mysql/patch-externallinks-drop-el_to.sql b/sql/mysql/patch-externallinks-drop-el_to.sql new file mode 100644 index 000000000000..5316a0b257e7 --- /dev/null +++ b/sql/mysql/patch-externallinks-drop-el_to.sql @@ -0,0 +1,12 @@ +-- 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 +DROP INDEX el_to ON /*_*/externallinks; +DROP INDEX el_index ON /*_*/externallinks; +DROP INDEX el_index_60 ON /*_*/externallinks; +DROP INDEX el_from_index_60 ON /*_*/externallinks; +ALTER TABLE /*_*/externallinks +DROP el_to, +DROP el_index, +DROP el_index_60;
\ No newline at end of file diff --git a/sql/mysql/patch-externallinks-el_to_default.sql b/sql/mysql/patch-externallinks-el_to_default.sql new file mode 100644 index 000000000000..41a4e1f8f29d --- /dev/null +++ b/sql/mysql/patch-externallinks-el_to_default.sql @@ -0,0 +1,8 @@ +-- 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 +ALTER TABLE /*_*/externallinks +CHANGE el_to el_to BLOB DEFAULT NULL, +CHANGE el_index el_index BLOB DEFAULT NULL, +CHANGE el_index_60 el_index_60 VARBINARY(60) DEFAULT '' NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-externallinks-el_to_path.sql b/sql/mysql/patch-externallinks-el_to_path.sql new file mode 100644 index 000000000000..189b7b14a13d --- /dev/null +++ b/sql/mysql/patch-externallinks-el_to_path.sql @@ -0,0 +1,10 @@ +-- 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 ON /*_*/externallinks; +ALTER TABLE /*_*/externallinks +ADD el_to_domain_index VARBINARY(255) DEFAULT '' NOT NULL, +ADD el_to_path BLOB DEFAULT NULL; +CREATE INDEX el_to_domain_index_to_path ON /*_*/externallinks ( el_to_domain_index, el_to_path(60) ); +CREATE INDEX el_from ON /*_*/externallinks (el_from);
\ No newline at end of file diff --git a/sql/mysql/patch-filearchive-fa_id.sql b/sql/mysql/patch-filearchive-fa_id.sql new file mode 100644 index 000000000000..2a651cfed072 --- /dev/null +++ b/sql/mysql/patch-filearchive-fa_id.sql @@ -0,0 +1,6 @@ +-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. +-- Source: maintenance/abstractSchemaChanges/patch-filearchive-fa_id.json +-- Do not modify this file directly. +-- See https://www.mediawiki.org/wiki/Manual:Schema_changes +ALTER TABLE /*_*/filearchive +CHANGE fa_id fa_id INT UNSIGNED AUTO_INCREMENT NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-filearchive-fa_name.sql b/sql/mysql/patch-filearchive-fa_name.sql new file mode 100644 index 000000000000..c224f7d3d448 --- /dev/null +++ b/sql/mysql/patch-filearchive-fa_name.sql @@ -0,0 +1,3 @@ +ALTER TABLE /*_*/filearchive + MODIFY fa_name VARBINARY(255) DEFAULT '' NOT NULL, + MODIFY fa_archive_name VARBINARY(255) DEFAULT ''; diff --git a/sql/mysql/patch-filearchive-fa_size_to_bigint.sql b/sql/mysql/patch-filearchive-fa_size_to_bigint.sql new file mode 100644 index 000000000000..07aa6660559c --- /dev/null +++ b/sql/mysql/patch-filearchive-fa_size_to_bigint.sql @@ -0,0 +1,6 @@ +-- 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 +ALTER TABLE /*_*/filearchive +CHANGE fa_size fa_size BIGINT UNSIGNED DEFAULT 0;
\ No newline at end of file diff --git a/sql/mysql/patch-image-img_major_mime-default.sql b/sql/mysql/patch-image-img_major_mime-default.sql new file mode 100644 index 000000000000..6915e45927c0 --- /dev/null +++ b/sql/mysql/patch-image-img_major_mime-default.sql @@ -0,0 +1,20 @@ +ALTER TABLE /*_*/image +CHANGE img_major_mime img_major_mime ENUM( + 'unknown', 'application', 'audio', + 'image', 'text', 'video', 'message', + 'model', 'multipart', 'chemical' + ) DEFAULT 'unknown' NOT NULL; + +ALTER TABLE /*_*/oldimage +CHANGE oi_major_mime oi_major_mime ENUM( + 'unknown', 'application', 'audio', + 'image', 'text', 'video', 'message', + 'model', 'multipart', 'chemical' + ) DEFAULT 'unknown' NOT NULL; + +ALTER TABLE /*_*/filearchive +CHANGE fa_major_mime fa_major_mime ENUM( + 'unknown', 'application', 'audio', + 'image', 'text', 'video', 'message', + 'model', 'multipart', 'chemical' + ) DEFAULT 'unknown'; diff --git a/sql/mysql/patch-image-img_name-varbinary.sql b/sql/mysql/patch-image-img_name-varbinary.sql new file mode 100644 index 000000000000..6a67a28bb6f5 --- /dev/null +++ b/sql/mysql/patch-image-img_name-varbinary.sql @@ -0,0 +1 @@ +ALTER TABLE /*_*/image MODIFY img_name VARBINARY(255) DEFAULT '' NOT NULL; diff --git a/sql/mysql/patch-image-img_size_to_bigint.sql b/sql/mysql/patch-image-img_size_to_bigint.sql new file mode 100644 index 000000000000..1c066fbfb7a8 --- /dev/null +++ b/sql/mysql/patch-image-img_size_to_bigint.sql @@ -0,0 +1,6 @@ +-- 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 +ALTER TABLE /*_*/image +CHANGE img_size img_size BIGINT UNSIGNED DEFAULT 0 NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-image-img_timestamp.sql b/sql/mysql/patch-image-img_timestamp.sql new file mode 100644 index 000000000000..8442f50237e9 --- /dev/null +++ b/sql/mysql/patch-image-img_timestamp.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/image + MODIFY img_timestamp BINARY(14) NOT NULL; diff --git a/sql/mysql/patch-imagelinks-il_to-varbinary.sql b/sql/mysql/patch-imagelinks-il_to-varbinary.sql new file mode 100644 index 000000000000..71615270c031 --- /dev/null +++ b/sql/mysql/patch-imagelinks-il_to-varbinary.sql @@ -0,0 +1 @@ +ALTER TABLE /*_*/imagelinks MODIFY il_to VARBINARY(255) NOT NULL default ''; diff --git a/sql/mysql/patch-ipblocks-ipb_id.sql b/sql/mysql/patch-ipblocks-ipb_id.sql new file mode 100644 index 000000000000..b05d8ab779bc --- /dev/null +++ b/sql/mysql/patch-ipblocks-ipb_id.sql @@ -0,0 +1,7 @@ +-- 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 +ALTER TABLE /*_*/ipblocks +CHANGE ipb_id ipb_id INT UNSIGNED AUTO_INCREMENT NOT NULL, +CHANGE ipb_parent_block_id ipb_parent_block_id INT UNSIGNED DEFAULT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-ipblocks_restrictions-ir_ipb_id.sql b/sql/mysql/patch-ipblocks_restrictions-ir_ipb_id.sql new file mode 100644 index 000000000000..413b290dc3eb --- /dev/null +++ b/sql/mysql/patch-ipblocks_restrictions-ir_ipb_id.sql @@ -0,0 +1,6 @@ +-- 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 +ALTER TABLE /*_*/ipblocks_restrictions +CHANGE ir_ipb_id ir_ipb_id INT UNSIGNED NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-ipblocks_restrictions-ir_type.sql b/sql/mysql/patch-ipblocks_restrictions-ir_type.sql new file mode 100644 index 000000000000..04aaa5e85872 --- /dev/null +++ b/sql/mysql/patch-ipblocks_restrictions-ir_type.sql @@ -0,0 +1 @@ +ALTER TABLE /*_*/ipblocks_restrictions CHANGE COLUMN ir_type ir_type TINYINT(4) NOT NULL; diff --git a/sql/mysql/patch-ipblocks_restrictions-ir_value.sql b/sql/mysql/patch-ipblocks_restrictions-ir_value.sql new file mode 100644 index 000000000000..c0ec90d1aa56 --- /dev/null +++ b/sql/mysql/patch-ipblocks_restrictions-ir_value.sql @@ -0,0 +1,6 @@ +-- 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 +ALTER TABLE /*_*/ipblocks_restrictions +CHANGE ir_value ir_value INT UNSIGNED NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-iwlinks-drop-iwl_prefix_from_title.sql b/sql/mysql/patch-iwlinks-drop-iwl_prefix_from_title.sql new file mode 100644 index 000000000000..14d434eab661 --- /dev/null +++ b/sql/mysql/patch-iwlinks-drop-iwl_prefix_from_title.sql @@ -0,0 +1,5 @@ +-- 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 +DROP INDEX iwl_prefix_from_title ON /*_*/iwlinks; diff --git a/sql/mysql/patch-iwlinks-iwl_title-varbinary.sql b/sql/mysql/patch-iwlinks-iwl_title-varbinary.sql new file mode 100644 index 000000000000..72650e543eb1 --- /dev/null +++ b/sql/mysql/patch-iwlinks-iwl_title-varbinary.sql @@ -0,0 +1 @@ +ALTER TABLE /*_*/iwlinks MODIFY iwl_title VARBINARY(255) NOT NULL default ''; diff --git a/sql/mysql/patch-job-job_title-varbinary.sql b/sql/mysql/patch-job-job_title-varbinary.sql new file mode 100644 index 000000000000..ee8d19bb1f24 --- /dev/null +++ b/sql/mysql/patch-job-job_title-varbinary.sql @@ -0,0 +1 @@ +ALTER TABLE /*_*/job MODIFY job_title VARBINARY(255) NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-job_job_timestamp.sql b/sql/mysql/patch-job_job_timestamp.sql new file mode 100644 index 000000000000..23076a3425d5 --- /dev/null +++ b/sql/mysql/patch-job_job_timestamp.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/job + MODIFY job_timestamp BINARY(14);
\ No newline at end of file diff --git a/sql/mysql/patch-job_job_token_timestamp.sql b/sql/mysql/patch-job_job_token_timestamp.sql new file mode 100644 index 000000000000..332178073e94 --- /dev/null +++ b/sql/mysql/patch-job_job_token_timestamp.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/job + MODIFY job_token_timestamp BINARY(14);
\ No newline at end of file diff --git a/sql/mysql/patch-langlinks-ll_title-varbinary.sql b/sql/mysql/patch-langlinks-ll_title-varbinary.sql new file mode 100644 index 000000000000..27f51bd9b8ce --- /dev/null +++ b/sql/mysql/patch-langlinks-ll_title-varbinary.sql @@ -0,0 +1 @@ +ALTER TABLE /*_*/langlinks MODIFY ll_title VARBINARY(255) NOT NULL default ''; diff --git a/sql/mysql/patch-linktarget.sql b/sql/mysql/patch-linktarget.sql new file mode 100644 index 000000000000..6e3b9cd94632 --- /dev/null +++ b/sql/mysql/patch-linktarget.sql @@ -0,0 +1,7 @@ +CREATE TABLE /*_*/linktarget ( + lt_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, + lt_namespace INT NOT NULL, + lt_title VARBINARY(255) NOT NULL, + UNIQUE INDEX lt_namespace_title (lt_namespace, lt_title), + PRIMARY KEY(lt_id) +) /*$wgDBTableOptions*/; diff --git a/sql/mysql/patch-logging-log_title-varbinary.sql b/sql/mysql/patch-logging-log_title-varbinary.sql new file mode 100644 index 000000000000..0bdc6e9606e5 --- /dev/null +++ b/sql/mysql/patch-logging-log_title-varbinary.sql @@ -0,0 +1 @@ +ALTER TABLE /*_*/logging MODIFY log_title VARBINARY(255) DEFAULT '' NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-logging-rename-indexes.sql b/sql/mysql/patch-logging-rename-indexes.sql new file mode 100644 index 000000000000..551ae2128793 --- /dev/null +++ b/sql/mysql/patch-logging-rename-indexes.sql @@ -0,0 +1,12 @@ +-- 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 ON /*_*/logging; +CREATE INDEX log_type_time ON /*_*/logging (log_type, log_timestamp); +DROP INDEX actor_time ON /*_*/logging; +CREATE INDEX log_actor_time ON /*_*/logging (log_actor, log_timestamp); +DROP INDEX page_time ON /*_*/logging; +CREATE INDEX log_page_time ON /*_*/logging ( log_namespace, log_title, log_timestamp ); +DROP INDEX times ON /*_*/logging; +CREATE INDEX log_times ON /*_*/logging (log_timestamp);
\ No newline at end of file diff --git a/sql/mysql/patch-objectcache-exptime-notnull.sql b/sql/mysql/patch-objectcache-exptime-notnull.sql new file mode 100644 index 000000000000..d641254efdf1 --- /dev/null +++ b/sql/mysql/patch-objectcache-exptime-notnull.sql @@ -0,0 +1,4 @@ +-- Clean the table first otherwise setting datatype of exptime would fail. +DELETE FROM /*_*/objectcache; +ALTER TABLE /*_*/objectcache + MODIFY exptime BINARY(14) NOT NULL; diff --git a/sql/mysql/patch-objectcache-modtoken.sql b/sql/mysql/patch-objectcache-modtoken.sql new file mode 100644 index 000000000000..a771643c0339 --- /dev/null +++ b/sql/mysql/patch-objectcache-modtoken.sql @@ -0,0 +1,7 @@ +-- 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 modtoken VARCHAR(17) DEFAULT '00000000000000000' NOT NULL, +ADD flags INT UNSIGNED DEFAULT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-oldimage-oi_name-varbinary.sql b/sql/mysql/patch-oldimage-oi_name-varbinary.sql new file mode 100644 index 000000000000..db93cad1d73c --- /dev/null +++ b/sql/mysql/patch-oldimage-oi_name-varbinary.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/oldimage MODIFY oi_name VARBINARY(255) DEFAULT '' NOT NULL, + MODIFY oi_archive_name VARBINARY(255) DEFAULT '' NOT NULL; diff --git a/sql/mysql/patch-oldimage-oi_size_to_bigint.sql b/sql/mysql/patch-oldimage-oi_size_to_bigint.sql new file mode 100644 index 000000000000..32cee222a57b --- /dev/null +++ b/sql/mysql/patch-oldimage-oi_size_to_bigint.sql @@ -0,0 +1,6 @@ +-- 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 +ALTER TABLE /*_*/oldimage +CHANGE oi_size oi_size BIGINT UNSIGNED DEFAULT 0 NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-oldimage-oi_timestamp.sql b/sql/mysql/patch-oldimage-oi_timestamp.sql new file mode 100644 index 000000000000..d7b20fb086dd --- /dev/null +++ b/sql/mysql/patch-oldimage-oi_timestamp.sql @@ -0,0 +1,5 @@ +-- 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 +CREATE INDEX oi_timestamp ON /*_*/oldimage (oi_timestamp);
\ No newline at end of file diff --git a/sql/mysql/patch-page-drop-page_restrictions.sql b/sql/mysql/patch-page-drop-page_restrictions.sql new file mode 100644 index 000000000000..c32a889d7e40 --- /dev/null +++ b/sql/mysql/patch-page-drop-page_restrictions.sql @@ -0,0 +1,6 @@ +-- 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 +ALTER TABLE /*_*/page +DROP page_restrictions;
\ No newline at end of file diff --git a/sql/mysql/patch-page-page_links_updated-noinfinite.sql b/sql/mysql/patch-page-page_links_updated-noinfinite.sql new file mode 100644 index 000000000000..a63869144c9f --- /dev/null +++ b/sql/mysql/patch-page-page_links_updated-noinfinite.sql @@ -0,0 +1,6 @@ +-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. +-- Source: maintenance/abstractSchemaChanges/patch-page-page_links_updated-noinfinite.json +-- Do not modify this file directly. +-- See https://www.mediawiki.org/wiki/Manual:Schema_changes +ALTER TABLE /*_*/page + CHANGE page_links_updated page_links_updated BINARY(14) DEFAULT NULL; diff --git a/sql/mysql/patch-page-page_title-varbinary.sql b/sql/mysql/patch-page-page_title-varbinary.sql new file mode 100644 index 000000000000..2604244582c2 --- /dev/null +++ b/sql/mysql/patch-page-page_title-varbinary.sql @@ -0,0 +1 @@ +ALTER TABLE /*_*/page MODIFY page_title VARBINARY(255) NOT NULL; diff --git a/sql/mysql/patch-page-rename-name_title-index.sql b/sql/mysql/patch-page-rename-name_title-index.sql new file mode 100644 index 000000000000..fb3c63b3e681 --- /dev/null +++ b/sql/mysql/patch-page-rename-name_title-index.sql @@ -0,0 +1,6 @@ +-- 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 ON /*_*/page; +CREATE UNIQUE INDEX page_name_title ON /*_*/page (page_namespace, page_title);
\ No newline at end of file diff --git a/sql/mysql/patch-page_props-pp_page.sql b/sql/mysql/patch-page_props-pp_page.sql new file mode 100644 index 000000000000..bf905afec4c8 --- /dev/null +++ b/sql/mysql/patch-page_props-pp_page.sql @@ -0,0 +1,6 @@ +-- 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 +ALTER TABLE /*_*/page_props +CHANGE pp_page pp_page INT UNSIGNED NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-page_restrictions-pr_page.sql b/sql/mysql/patch-page_restrictions-pr_page.sql new file mode 100644 index 000000000000..cd433872d592 --- /dev/null +++ b/sql/mysql/patch-page_restrictions-pr_page.sql @@ -0,0 +1,6 @@ +-- 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 +ALTER TABLE /*_*/page_restrictions +CHANGE pr_page pr_page INT UNSIGNED NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-pagelinks-drop-pl_title.sql b/sql/mysql/patch-pagelinks-drop-pl_title.sql new file mode 100644 index 000000000000..b0ea1e80605c --- /dev/null +++ b/sql/mysql/patch-pagelinks-drop-pl_title.sql @@ -0,0 +1,13 @@ +-- 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 +DROP INDEX pl_namespace ON /*_*/pagelinks; +DROP INDEX pl_backlinks_namespace ON /*_*/pagelinks; +DROP INDEX `primary` ON /*_*/pagelinks; +ALTER TABLE /*_*/pagelinks + DROP pl_namespace, + DROP pl_title, + CHANGE pl_target_id pl_target_id BIGINT UNSIGNED NOT NULL; +ALTER TABLE /*_*/pagelinks + ADD PRIMARY KEY (pl_from, pl_target_id); diff --git a/sql/mysql/patch-pagelinks-pl_title-varbinary.sql b/sql/mysql/patch-pagelinks-pl_title-varbinary.sql new file mode 100644 index 000000000000..3582cb4dcb19 --- /dev/null +++ b/sql/mysql/patch-pagelinks-pl_title-varbinary.sql @@ -0,0 +1 @@ +ALTER TABLE /*_*/pagelinks MODIFY pl_title VARBINARY(255) NOT NULL default ''; diff --git a/sql/mysql/patch-pagelinks-target_id.sql b/sql/mysql/patch-pagelinks-target_id.sql new file mode 100644 index 000000000000..7039e2777f78 --- /dev/null +++ b/sql/mysql/patch-pagelinks-target_id.sql @@ -0,0 +1,8 @@ +-- 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 +ALTER TABLE /*_*/pagelinks +ADD pl_target_id BIGINT UNSIGNED DEFAULT NULL; +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/mysql/patch-protected_titles-pt_title-varbinary.sql b/sql/mysql/patch-protected_titles-pt_title-varbinary.sql new file mode 100644 index 000000000000..fa3fb6d85822 --- /dev/null +++ b/sql/mysql/patch-protected_titles-pt_title-varbinary.sql @@ -0,0 +1 @@ +ALTER TABLE /*_*/protected_titles MODIFY pt_title VARBINARY(255) NOT NULL; diff --git a/sql/mysql/patch-querycache-qc_title-varbinary.sql b/sql/mysql/patch-querycache-qc_title-varbinary.sql new file mode 100644 index 000000000000..8f08ce4036ad --- /dev/null +++ b/sql/mysql/patch-querycache-qc_title-varbinary.sql @@ -0,0 +1 @@ +ALTER TABLE /*_*/querycache MODIFY qc_title VARBINARY(255) DEFAULT '' NOT NULL; diff --git a/sql/mysql/patch-querycachetwo-qcc_title-varbinary.sql b/sql/mysql/patch-querycachetwo-qcc_title-varbinary.sql new file mode 100644 index 000000000000..3a2964a5b170 --- /dev/null +++ b/sql/mysql/patch-querycachetwo-qcc_title-varbinary.sql @@ -0,0 +1,3 @@ +ALTER TABLE /*_*/querycachetwo + MODIFY qcc_title VARBINARY(255) DEFAULT '' NOT NULL, + MODIFY qcc_titletwo VARBINARY(255) DEFAULT '' NOT NULL; diff --git a/sql/mysql/patch-recentchanges-rc_id-bigint.sql b/sql/mysql/patch-recentchanges-rc_id-bigint.sql new file mode 100644 index 000000000000..8d0a2d58381a --- /dev/null +++ b/sql/mysql/patch-recentchanges-rc_id-bigint.sql @@ -0,0 +1,6 @@ +-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. +-- Source: maintenance/abstractSchemaChanges/patch-recentchanges-rc_id-bigint.json +-- Do not modify this file directly. +-- See https://www.mediawiki.org/wiki/Manual:Schema_changes +ALTER TABLE /*_*/recentchanges +CHANGE rc_id rc_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-recentchanges-rc_id.sql b/sql/mysql/patch-recentchanges-rc_id.sql new file mode 100644 index 000000000000..940a38aace01 --- /dev/null +++ b/sql/mysql/patch-recentchanges-rc_id.sql @@ -0,0 +1,6 @@ +-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. +-- Source: maintenance/abstractSchemaChanges/patch-recentchanges-rc_id.json +-- Do not modify this file directly. +-- See https://www.mediawiki.org/wiki/Manual:Schema_changes +ALTER TABLE /*_*/recentchanges +CHANGE rc_id rc_id INT UNSIGNED AUTO_INCREMENT NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-recentchanges-rc_new_name_timestamp.sql b/sql/mysql/patch-recentchanges-rc_new_name_timestamp.sql new file mode 100644 index 000000000000..a138bc63fdf5 --- /dev/null +++ b/sql/mysql/patch-recentchanges-rc_new_name_timestamp.sql @@ -0,0 +1,6 @@ +-- 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 new_name_timestamp ON /*_*/recentchanges; +CREATE INDEX rc_new_name_timestamp ON /*_*/recentchanges ( rc_new, rc_namespace, rc_timestamp );
\ No newline at end of file diff --git a/sql/mysql/patch-recentchanges-rc_timestamp.sql b/sql/mysql/patch-recentchanges-rc_timestamp.sql new file mode 100644 index 000000000000..acfe6b82c511 --- /dev/null +++ b/sql/mysql/patch-recentchanges-rc_timestamp.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/recentchanges + MODIFY rc_timestamp BINARY(14) NOT NULL; diff --git a/sql/mysql/patch-recentchanges-rc_title-varbinary.sql b/sql/mysql/patch-recentchanges-rc_title-varbinary.sql new file mode 100644 index 000000000000..2c8b8794747d --- /dev/null +++ b/sql/mysql/patch-recentchanges-rc_title-varbinary.sql @@ -0,0 +1,3 @@ +ALTER TABLE /*_*/recentchanges + MODIFY rc_title VARBINARY(255) DEFAULT '' NOT NULL, + MODIFY rc_source VARBINARY(16) DEFAULT '' NOT NULL; diff --git a/sql/mysql/patch-redirect-rd_title-varbinary.sql b/sql/mysql/patch-redirect-rd_title-varbinary.sql new file mode 100644 index 000000000000..b0ee2f0a9f24 --- /dev/null +++ b/sql/mysql/patch-redirect-rd_title-varbinary.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/redirect MODIFY rd_title VARBINARY(255) NOT NULL default '', + MODIFY rd_fragment VARBINARY(255) default NULL; diff --git a/sql/mysql/patch-revision-cleanup.sql b/sql/mysql/patch-revision-cleanup.sql new file mode 100644 index 000000000000..87f1b8e0cd57 --- /dev/null +++ b/sql/mysql/patch-revision-cleanup.sql @@ -0,0 +1,9 @@ +-- 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 +ALTER TABLE /*_*/revision + CHANGE rev_id rev_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, + CHANGE rev_comment_id rev_comment_id BIGINT UNSIGNED NOT NULL, + CHANGE rev_actor rev_actor BIGINT UNSIGNED NOT NULL, + CHANGE rev_parent_id rev_parent_id BIGINT UNSIGNED DEFAULT NULL; diff --git a/sql/mysql/patch-revision-rename-index.sql b/sql/mysql/patch-revision-rename-index.sql new file mode 100644 index 000000000000..d771b4046384 --- /dev/null +++ b/sql/mysql/patch-revision-rename-index.sql @@ -0,0 +1,6 @@ +-- 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 page_timestamp ON /*_*/revision; +CREATE INDEX rev_page_timestamp ON /*_*/revision (rev_page, rev_timestamp);
\ No newline at end of file diff --git a/sql/mysql/patch-searchindex-pk-titlelength.sql b/sql/mysql/patch-searchindex-pk-titlelength.sql new file mode 100644 index 000000000000..5e37ce32627c --- /dev/null +++ b/sql/mysql/patch-searchindex-pk-titlelength.sql @@ -0,0 +1,8 @@ +-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. +-- Source: maintenance/abstractSchemaChanges/patch-searchindex-innodb-pk-titlelength.json +-- Do not modify this file directly. +-- See https://www.mediawiki.org/wiki/Manual:Schema_changes +DROP INDEX si_page ON /*_*/searchindex; +ALTER TABLE /*_*/searchindex + CHANGE si_title si_title MEDIUMTEXT NOT NULL, + ADD PRIMARY KEY (si_page); diff --git a/sql/mysql/patch-searchindex.sql b/sql/mysql/patch-searchindex.sql new file mode 100644 index 000000000000..2571c3596535 --- /dev/null +++ b/sql/mysql/patch-searchindex.sql @@ -0,0 +1,40 @@ +-- Break fulltext search index out to separate table from cur +-- This is being done mainly to allow us to use InnoDB tables +-- for the main db while keeping the MyISAM fulltext index for +-- search. + +-- 2002-12-16, 2003-01-25 Brooke Vibber <bvibber@wikimedia.org> + +-- Creating searchindex table... +DROP TABLE IF EXISTS /*$wgDBprefix*/searchindex; +CREATE TABLE /*$wgDBprefix*/searchindex ( + -- Key to page_id + si_page int unsigned NOT NULL, + + -- Munged version of title + si_title varchar(255) NOT NULL default '', + + -- Munged version of body text + si_text mediumtext NOT NULL, + + UNIQUE KEY (si_page) + +) ENGINE=MyISAM; + +-- Copying data into new table... +INSERT INTO /*$wgDBprefix*/searchindex + (si_page,si_title,si_text) + SELECT + cur_id,cur_ind_title,cur_ind_text + FROM /*$wgDBprefix*/cur; + + +-- Creating fulltext index... +ALTER TABLE /*$wgDBprefix*/searchindex + ADD FULLTEXT si_title (si_title), + ADD FULLTEXT si_text (si_text); + +-- Dropping index columns from cur table. +ALTER TABLE /*$wgDBprefix*/cur + DROP COLUMN cur_ind_title, + DROP COLUMN cur_ind_text; diff --git a/sql/mysql/patch-site_identifiers-rename-indexes.sql b/sql/mysql/patch-site_identifiers-rename-indexes.sql new file mode 100644 index 000000000000..acf14c53422e --- /dev/null +++ b/sql/mysql/patch-site_identifiers-rename-indexes.sql @@ -0,0 +1,8 @@ +-- 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 ON /*_*/site_identifiers; +CREATE INDEX si_site ON /*_*/site_identifiers (si_site); +DROP INDEX site_ids_key ON /*_*/site_identifiers; +CREATE INDEX si_key ON /*_*/site_identifiers (si_key);
\ No newline at end of file diff --git a/sql/mysql/patch-sites-drop_indexes.sql b/sql/mysql/patch-sites-drop_indexes.sql new file mode 100644 index 000000000000..5f413316af04 --- /dev/null +++ b/sql/mysql/patch-sites-drop_indexes.sql @@ -0,0 +1,11 @@ +-- 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 +DROP INDEX site_type ON /*_*/sites; +DROP INDEX site_group ON /*_*/sites; +DROP INDEX site_source ON /*_*/sites; +DROP INDEX site_language ON /*_*/sites; +DROP INDEX site_protocol ON /*_*/sites; +DROP INDEX site_domain ON /*_*/sites; +DROP INDEX site_forward ON /*_*/sites; diff --git a/sql/mysql/patch-sites-rename-indexes.sql b/sql/mysql/patch-sites-rename-indexes.sql new file mode 100644 index 000000000000..bcfd2604475a --- /dev/null +++ b/sql/mysql/patch-sites-rename-indexes.sql @@ -0,0 +1,20 @@ +-- 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 ON /*_*/sites; +CREATE UNIQUE INDEX site_global_key ON /*_*/sites (site_global_key); +DROP INDEX sites_type ON /*_*/sites; +CREATE INDEX site_type ON /*_*/sites (site_type); +DROP INDEX sites_group ON /*_*/sites; +CREATE INDEX site_group ON /*_*/sites (site_group); +DROP INDEX sites_source ON /*_*/sites; +CREATE INDEX site_source ON /*_*/sites (site_source); +DROP INDEX sites_language ON /*_*/sites; +CREATE INDEX site_language ON /*_*/sites (site_language); +DROP INDEX sites_protocol ON /*_*/sites; +CREATE INDEX site_protocol ON /*_*/sites (site_protocol); +DROP INDEX sites_domain ON /*_*/sites; +CREATE INDEX site_domain ON /*_*/sites (site_domain); +DROP INDEX sites_forward ON /*_*/sites; +CREATE INDEX site_forward ON /*_*/sites (site_forward);
\ No newline at end of file diff --git a/sql/mysql/patch-slot_roles-role_id.sql b/sql/mysql/patch-slot_roles-role_id.sql new file mode 100644 index 000000000000..6f13dfc2a447 --- /dev/null +++ b/sql/mysql/patch-slot_roles-role_id.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/slot_roles + MODIFY role_id INT AUTO_INCREMENT NOT NULL; diff --git a/sql/mysql/patch-templatelinks-drop-tl_title.sql b/sql/mysql/patch-templatelinks-drop-tl_title.sql new file mode 100644 index 000000000000..2332d2c230f8 --- /dev/null +++ b/sql/mysql/patch-templatelinks-drop-tl_title.sql @@ -0,0 +1,9 @@ +-- 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 ON /*_*/templatelinks; +DROP INDEX tl_backlinks_namespace ON /*_*/templatelinks; +ALTER TABLE /*_*/templatelinks +DROP tl_namespace, +DROP tl_title;
\ No newline at end of file diff --git a/sql/mysql/patch-templatelinks-target_id.sql b/sql/mysql/patch-templatelinks-target_id.sql new file mode 100644 index 000000000000..43cc6f53e784 --- /dev/null +++ b/sql/mysql/patch-templatelinks-target_id.sql @@ -0,0 +1,8 @@ +-- 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 +ALTER TABLE /*_*/templatelinks +ADD tl_target_id BIGINT UNSIGNED DEFAULT NULL; +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/mysql/patch-templatelinks-tl_title-nullable.sql b/sql/mysql/patch-templatelinks-tl_title-nullable.sql new file mode 100644 index 000000000000..5770482e8c68 --- /dev/null +++ b/sql/mysql/patch-templatelinks-tl_title-nullable.sql @@ -0,0 +1,10 @@ +-- 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 +ALTER TABLE /*_*/templatelinks +DROP PRIMARY KEY; +ALTER TABLE /*_*/templatelinks +CHANGE tl_target_id tl_target_id BIGINT UNSIGNED NOT NULL; +ALTER TABLE /*_*/templatelinks +ADD PRIMARY KEY (tl_from, tl_target_id);
\ No newline at end of file diff --git a/sql/mysql/patch-templatelinks-tl_title-varbinary.sql b/sql/mysql/patch-templatelinks-tl_title-varbinary.sql new file mode 100644 index 000000000000..16a489d430d2 --- /dev/null +++ b/sql/mysql/patch-templatelinks-tl_title-varbinary.sql @@ -0,0 +1 @@ +ALTER TABLE /*_*/templatelinks MODIFY tl_title VARBINARY(255) NOT NULL default ''; diff --git a/sql/mysql/patch-testrun.sql b/sql/mysql/patch-testrun.sql new file mode 100644 index 000000000000..a2bb05ae5db8 --- /dev/null +++ b/sql/mysql/patch-testrun.sql @@ -0,0 +1,33 @@ +-- +-- Optional tables for parserTests recording mode +-- With --record option, success data will be saved to these tables, +-- and comparisons of what's changed from the previous run will be +-- displayed at the end of each run. +-- + +drop table if exists /*$wgDBprefix*/testitem; +drop table if exists /*$wgDBprefix*/testrun; + +create table /*$wgDBprefix*/testrun ( + tr_id int not null auto_increment, + + tr_date char(14) binary, + tr_mw_version blob, + tr_php_version blob, + tr_db_version blob, + tr_uname blob, + + primary key (tr_id) +) engine=InnoDB; + +create table /*$wgDBprefix*/testitem ( + ti_run int not null, + ti_name varchar(255), + ti_success bool, + + unique key (ti_run, ti_name), + key (ti_run, ti_success), + + foreign key (ti_run) references /*$wgDBprefix*/testrun(tr_id) + on delete cascade +) engine=InnoDB; diff --git a/sql/mysql/patch-uploadstash-us_size_to_bigint.sql b/sql/mysql/patch-uploadstash-us_size_to_bigint.sql new file mode 100644 index 000000000000..8bc37d5d72c7 --- /dev/null +++ b/sql/mysql/patch-uploadstash-us_size_to_bigint.sql @@ -0,0 +1,6 @@ +-- 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 +ALTER TABLE /*_*/uploadstash +CHANGE us_size us_size BIGINT UNSIGNED NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-uploadstash-us_timestamp.sql b/sql/mysql/patch-uploadstash-us_timestamp.sql new file mode 100644 index 000000000000..1b491a215dab --- /dev/null +++ b/sql/mysql/patch-uploadstash-us_timestamp.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/uploadstash + MODIFY us_timestamp BINARY(14) NOT NULL; diff --git a/sql/mysql/patch-user-user_editcount.sql b/sql/mysql/patch-user-user_editcount.sql new file mode 100644 index 000000000000..5c04e1ae77b5 --- /dev/null +++ b/sql/mysql/patch-user-user_editcount.sql @@ -0,0 +1,6 @@ +-- 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 +ALTER TABLE /*_*/user +CHANGE user_editcount user_editcount INT UNSIGNED DEFAULT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-user-user_is_temp.sql b/sql/mysql/patch-user-user_is_temp.sql new file mode 100644 index 000000000000..a64c6d34ff86 --- /dev/null +++ b/sql/mysql/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 user_is_temp TINYINT(1) DEFAULT 0 NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-user_autocreate_serial-uas_year.sql b/sql/mysql/patch-user_autocreate_serial-uas_year.sql new file mode 100644 index 000000000000..5065c07808c3 --- /dev/null +++ b/sql/mysql/patch-user_autocreate_serial-uas_year.sql @@ -0,0 +1,9 @@ +-- 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 +DROP INDEX `primary` ON /*_*/user_autocreate_serial; +ALTER TABLE /*_*/user_autocreate_serial + ADD uas_year SMALLINT UNSIGNED NOT NULL; +ALTER TABLE /*_*/user_autocreate_serial + ADD PRIMARY KEY (uas_shard, uas_year); diff --git a/sql/mysql/patch-user_autocreate_serial.sql b/sql/mysql/patch-user_autocreate_serial.sql new file mode 100644 index 000000000000..53f9f24229a9 --- /dev/null +++ b/sql/mysql/patch-user_autocreate_serial.sql @@ -0,0 +1,5 @@ +CREATE TABLE /*_*/user_autocreate_serial ( + uas_shard INT UNSIGNED NOT NULL, + uas_value INT UNSIGNED NOT NULL, + PRIMARY KEY(uas_shard) +) /*$wgDBTableOptions*/; diff --git a/sql/mysql/patch-user_newtalk-user_last_timestamp-binary.sql b/sql/mysql/patch-user_newtalk-user_last_timestamp-binary.sql new file mode 100644 index 000000000000..e53361db99a0 --- /dev/null +++ b/sql/mysql/patch-user_newtalk-user_last_timestamp-binary.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/user_newtalk + MODIFY user_last_timestamp BINARY(14);
\ No newline at end of file diff --git a/sql/mysql/patch-user_properties-rename-index.sql b/sql/mysql/patch-user_properties-rename-index.sql new file mode 100644 index 000000000000..6547e77c342a --- /dev/null +++ b/sql/mysql/patch-user_properties-rename-index.sql @@ -0,0 +1,6 @@ +-- 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 ON /*_*/user_properties; +CREATE INDEX up_property ON /*_*/user_properties (up_property);
\ No newline at end of file diff --git a/sql/mysql/patch-user_table-updates.sql b/sql/mysql/patch-user_table-updates.sql new file mode 100644 index 000000000000..d2e072a98225 --- /dev/null +++ b/sql/mysql/patch-user_table-updates.sql @@ -0,0 +1,8 @@ +-- 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 +ALTER TABLE /*_*/user +CHANGE user_name user_name VARBINARY(255) DEFAULT '' NOT NULL, +CHANGE user_real_name user_real_name VARBINARY(255) DEFAULT '' NOT NULL, +CHANGE user_touched user_touched BINARY(14) NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/patch-watchlist-namespace_title-rename-index.sql b/sql/mysql/patch-watchlist-namespace_title-rename-index.sql new file mode 100644 index 000000000000..3974c4a7b19a --- /dev/null +++ b/sql/mysql/patch-watchlist-namespace_title-rename-index.sql @@ -0,0 +1,6 @@ +-- 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 namespace_title ON /*_*/watchlist; +CREATE INDEX wl_namespace_title ON /*_*/watchlist (wl_namespace, wl_title);
\ No newline at end of file diff --git a/sql/mysql/patch-watchlist-wl_notificationtimestamp.sql b/sql/mysql/patch-watchlist-wl_notificationtimestamp.sql new file mode 100644 index 000000000000..0345ce23e3cb --- /dev/null +++ b/sql/mysql/patch-watchlist-wl_notificationtimestamp.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/watchlist + MODIFY wl_notificationtimestamp BINARY(14) DEFAULT NULL; diff --git a/sql/mysql/patch-watchlist-wl_title-varbinary.sql b/sql/mysql/patch-watchlist-wl_title-varbinary.sql new file mode 100644 index 000000000000..9305e1630a73 --- /dev/null +++ b/sql/mysql/patch-watchlist-wl_title-varbinary.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/watchlist + MODIFY wl_title VARBINARY(255) DEFAULT '' NOT NULL;
\ No newline at end of file diff --git a/sql/mysql/tables-generated.sql b/sql/mysql/tables-generated.sql new file mode 100644 index 000000000000..09503a07c785 --- /dev/null +++ b/sql/mysql/tables-generated.sql @@ -0,0 +1,876 @@ +-- 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 VARBINARY(32) NOT NULL, + si_key VARBINARY(32) NOT NULL, + si_site INT UNSIGNED NOT NULL, + INDEX si_site (si_site), + INDEX si_key (si_key), + PRIMARY KEY(si_type, si_key) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/updatelog ( + ul_key VARCHAR(255) NOT NULL, + ul_value BLOB DEFAULT NULL, + PRIMARY KEY(ul_key) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/actor ( + actor_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, + actor_user INT UNSIGNED DEFAULT NULL, + actor_name VARBINARY(255) NOT NULL, + UNIQUE INDEX actor_user (actor_user), + UNIQUE INDEX actor_name (actor_name), + PRIMARY KEY(actor_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/user_former_groups ( + ufg_user INT UNSIGNED DEFAULT 0 NOT NULL, + ufg_group VARBINARY(255) DEFAULT '' NOT NULL, + PRIMARY KEY(ufg_user, ufg_group) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/bot_passwords ( + bp_user INT UNSIGNED NOT NULL, + bp_app_id VARBINARY(32) NOT NULL, + bp_password TINYBLOB NOT NULL, + bp_token BINARY(32) DEFAULT '' NOT NULL, + bp_restrictions BLOB NOT NULL, + bp_grants BLOB NOT NULL, + PRIMARY KEY(bp_user, bp_app_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/comment ( + comment_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, + comment_hash INT NOT NULL, + comment_text BLOB NOT NULL, + comment_data BLOB DEFAULT NULL, + INDEX comment_hash (comment_hash), + PRIMARY KEY(comment_id) +) /*$wgDBTableOptions*/; + + +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, + INDEX slot_revision_origin_role ( + slot_revision_id, slot_origin, slot_role_id + ), + PRIMARY KEY(slot_revision_id, slot_role_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/site_stats ( + ss_row_id INT 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) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/user_properties ( + up_user INT UNSIGNED NOT NULL, + up_property VARBINARY(255) NOT NULL, + up_value BLOB DEFAULT NULL, + INDEX up_property (up_property), + PRIMARY KEY(up_user, up_property) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/log_search ( + ls_field VARBINARY(32) NOT NULL, + ls_value VARCHAR(255) NOT NULL, + ls_log_id INT UNSIGNED DEFAULT 0 NOT NULL, + INDEX ls_log_id (ls_log_id), + PRIMARY KEY(ls_field, ls_value, ls_log_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/change_tag ( + ct_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + ct_rc_id BIGINT UNSIGNED DEFAULT NULL, + ct_log_id INT UNSIGNED DEFAULT NULL, + ct_rev_id INT UNSIGNED DEFAULT NULL, + ct_params BLOB DEFAULT NULL, + ct_tag_id INT UNSIGNED NOT NULL, + UNIQUE INDEX ct_rc_tag_id (ct_rc_id, ct_tag_id), + UNIQUE INDEX ct_log_tag_id (ct_log_id, ct_tag_id), + UNIQUE INDEX ct_rev_tag_id (ct_rev_id, ct_tag_id), + INDEX ct_tag_id_id ( + ct_tag_id, ct_rc_id, ct_rev_id, ct_log_id + ), + PRIMARY KEY(ct_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/content ( + content_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, + content_size INT UNSIGNED NOT NULL, + content_sha1 VARBINARY(32) NOT NULL, + content_model SMALLINT UNSIGNED NOT NULL, + content_address VARBINARY(255) NOT NULL, + PRIMARY KEY(content_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/l10n_cache ( + lc_lang VARBINARY(35) NOT NULL, + lc_key VARCHAR(255) NOT NULL, + lc_value MEDIUMBLOB NOT NULL, + PRIMARY KEY(lc_lang, lc_key) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/module_deps ( + md_module VARBINARY(255) NOT NULL, + md_skin VARBINARY(32) NOT NULL, + md_deps MEDIUMBLOB NOT NULL, + PRIMARY KEY(md_module, md_skin) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/redirect ( + rd_from INT UNSIGNED DEFAULT 0 NOT NULL, + rd_namespace INT DEFAULT 0 NOT NULL, + rd_title VARBINARY(255) DEFAULT '' NOT NULL, + rd_interwiki VARCHAR(32) DEFAULT NULL, + rd_fragment VARBINARY(255) DEFAULT NULL, + INDEX rd_ns_title (rd_namespace, rd_title, rd_from), + PRIMARY KEY(rd_from) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/pagelinks ( + pl_from INT UNSIGNED DEFAULT 0 NOT NULL, + pl_target_id BIGINT UNSIGNED NOT NULL, + pl_from_namespace INT DEFAULT 0 NOT NULL, + INDEX pl_target_id (pl_target_id, pl_from), + INDEX pl_backlinks_namespace_target_id ( + pl_from_namespace, pl_target_id, + pl_from + ), + PRIMARY KEY(pl_from, pl_target_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/templatelinks ( + tl_from INT UNSIGNED DEFAULT 0 NOT NULL, + tl_target_id BIGINT UNSIGNED NOT NULL, + tl_from_namespace INT DEFAULT 0 NOT NULL, + INDEX tl_target_id (tl_target_id, tl_from), + INDEX tl_backlinks_namespace_target_id ( + tl_from_namespace, tl_target_id, + tl_from + ), + PRIMARY KEY(tl_from, tl_target_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/imagelinks ( + il_from INT UNSIGNED DEFAULT 0 NOT NULL, + il_to VARBINARY(255) DEFAULT '' NOT NULL, + il_from_namespace INT DEFAULT 0 NOT NULL, + INDEX il_to (il_to, il_from), + INDEX il_backlinks_namespace ( + il_from_namespace, il_to, il_from + ), + PRIMARY KEY(il_from, il_to) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/langlinks ( + ll_from INT UNSIGNED DEFAULT 0 NOT NULL, + ll_lang VARBINARY(35) DEFAULT '' NOT NULL, + ll_title VARBINARY(255) DEFAULT '' NOT NULL, + INDEX ll_lang (ll_lang, ll_title), + PRIMARY KEY(ll_from, ll_lang) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/iwlinks ( + iwl_from INT UNSIGNED DEFAULT 0 NOT NULL, + iwl_prefix VARBINARY(32) DEFAULT '' NOT NULL, + iwl_title VARBINARY(255) DEFAULT '' NOT NULL, + INDEX iwl_prefix_title_from (iwl_prefix, iwl_title, iwl_from), + PRIMARY KEY(iwl_from, iwl_prefix, iwl_title) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/category ( + cat_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + cat_title VARBINARY(255) NOT NULL, + cat_pages INT DEFAULT 0 NOT NULL, + cat_subcats INT DEFAULT 0 NOT NULL, + cat_files INT DEFAULT 0 NOT NULL, + UNIQUE INDEX cat_title (cat_title), + INDEX cat_pages (cat_pages), + PRIMARY KEY(cat_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/watchlist_expiry ( + we_item INT UNSIGNED NOT NULL, + we_expiry BINARY(14) NOT NULL, + INDEX we_expiry (we_expiry), + PRIMARY KEY(we_item) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/change_tag_def ( + ctd_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + ctd_name VARBINARY(255) NOT NULL, + ctd_user_defined TINYINT(1) NOT NULL, + ctd_count BIGINT UNSIGNED DEFAULT 0 NOT NULL, + UNIQUE INDEX ctd_name (ctd_name), + INDEX ctd_count (ctd_count), + INDEX ctd_user_defined (ctd_user_defined), + PRIMARY KEY(ctd_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/ipblocks_restrictions ( + ir_ipb_id INT UNSIGNED NOT NULL, + ir_type TINYINT(4) NOT NULL, + ir_value INT UNSIGNED NOT NULL, + INDEX ir_type_value (ir_type, ir_value), + PRIMARY KEY(ir_ipb_id, ir_type, ir_value) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/querycache ( + qc_type VARBINARY(32) NOT NULL, + qc_value INT UNSIGNED DEFAULT 0 NOT NULL, + qc_namespace INT DEFAULT 0 NOT NULL, + qc_title VARBINARY(255) DEFAULT '' NOT NULL, + INDEX qc_type (qc_type, qc_value) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/querycachetwo ( + qcc_type VARBINARY(32) NOT NULL, + qcc_value INT UNSIGNED DEFAULT 0 NOT NULL, + qcc_namespace INT DEFAULT 0 NOT NULL, + qcc_title VARBINARY(255) DEFAULT '' NOT NULL, + qcc_namespacetwo INT DEFAULT 0 NOT NULL, + qcc_titletwo VARBINARY(255) DEFAULT '' NOT NULL, + INDEX qcc_type (qcc_type, qcc_value), + INDEX qcc_title ( + qcc_type, qcc_namespace, qcc_title + ), + INDEX qcc_titletwo ( + qcc_type, qcc_namespacetwo, qcc_titletwo + ) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/page_restrictions ( + pr_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + pr_page INT UNSIGNED NOT NULL, + pr_type VARBINARY(60) NOT NULL, + pr_level VARBINARY(60) NOT NULL, + pr_cascade TINYINT NOT NULL, + pr_expiry VARBINARY(14) DEFAULT NULL, + UNIQUE INDEX pr_pagetype (pr_page, pr_type), + INDEX pr_typelevel (pr_type, pr_level), + INDEX pr_level (pr_level), + INDEX pr_cascade (pr_cascade), + PRIMARY KEY(pr_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/user_groups ( + ug_user INT UNSIGNED DEFAULT 0 NOT NULL, + ug_group VARBINARY(255) DEFAULT '' NOT NULL, + ug_expiry VARBINARY(14) DEFAULT NULL, + INDEX ug_group (ug_group), + INDEX ug_expiry (ug_expiry), + PRIMARY KEY(ug_user, ug_group) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/querycache_info ( + qci_type VARBINARY(32) DEFAULT '' NOT NULL, + qci_timestamp BINARY(14) DEFAULT '19700101000000' NOT NULL, + PRIMARY KEY(qci_type) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/watchlist ( + wl_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + wl_user INT UNSIGNED NOT NULL, + wl_namespace INT DEFAULT 0 NOT NULL, + wl_title VARBINARY(255) DEFAULT '' NOT NULL, + wl_notificationtimestamp BINARY(14) DEFAULT NULL, + UNIQUE INDEX wl_user (wl_user, wl_namespace, wl_title), + INDEX wl_namespace_title (wl_namespace, wl_title), + INDEX wl_user_notificationtimestamp ( + wl_user, wl_notificationtimestamp + ), + PRIMARY KEY(wl_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/sites ( + site_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + site_global_key VARBINARY(64) NOT NULL, + site_type VARBINARY(32) NOT NULL, + site_group VARBINARY(32) NOT NULL, + site_source VARBINARY(32) NOT NULL, + site_language VARBINARY(35) NOT NULL, + site_protocol VARBINARY(32) NOT NULL, + site_domain VARCHAR(255) NOT NULL, + site_data BLOB NOT NULL, + site_forward TINYINT(1) NOT NULL, + site_config BLOB NOT NULL, + UNIQUE INDEX site_global_key (site_global_key), + PRIMARY KEY(site_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/user_newtalk ( + user_id INT UNSIGNED DEFAULT 0 NOT NULL, + user_ip VARBINARY(40) DEFAULT '' NOT NULL, + user_last_timestamp BINARY(14) DEFAULT NULL, + INDEX un_user_id (user_id), + INDEX un_user_ip (user_ip) +) /*$wgDBTableOptions*/; + + +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 TINYINT(1) NOT NULL, + iw_trans TINYINT DEFAULT 0 NOT NULL, + PRIMARY KEY(iw_prefix) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/protected_titles ( + pt_namespace INT NOT NULL, + pt_title VARBINARY(255) NOT NULL, + pt_user INT UNSIGNED NOT NULL, + pt_reason_id BIGINT UNSIGNED NOT NULL, + pt_timestamp BINARY(14) NOT NULL, + pt_expiry VARBINARY(14) NOT NULL, + pt_create_perm VARBINARY(60) NOT NULL, + INDEX pt_timestamp (pt_timestamp), + PRIMARY KEY(pt_namespace, pt_title) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/externallinks ( + el_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + el_from INT UNSIGNED DEFAULT 0 NOT NULL, + el_to_domain_index VARBINARY(255) DEFAULT '' NOT NULL, + el_to_path BLOB DEFAULT NULL, + INDEX el_from (el_from), + INDEX el_to_domain_index_to_path ( + el_to_domain_index, + el_to_path(60) + ), + PRIMARY KEY(el_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/ip_changes ( + ipc_rev_id INT UNSIGNED DEFAULT 0 NOT NULL, + ipc_rev_timestamp BINARY(14) NOT NULL, + ipc_hex VARBINARY(35) DEFAULT '' NOT NULL, + INDEX ipc_rev_timestamp (ipc_rev_timestamp), + INDEX ipc_hex_time (ipc_hex, ipc_rev_timestamp), + PRIMARY KEY(ipc_rev_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/page_props ( + pp_page INT UNSIGNED NOT NULL, + pp_propname VARBINARY(60) NOT NULL, + pp_value BLOB NOT NULL, + pp_sortkey FLOAT DEFAULT NULL, + UNIQUE INDEX pp_propname_page (pp_propname, pp_page), + UNIQUE INDEX pp_propname_sortkey_page (pp_propname, pp_sortkey, pp_page), + PRIMARY KEY(pp_page, pp_propname) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/job ( + job_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + job_cmd VARBINARY(60) DEFAULT '' NOT NULL, + job_namespace INT NOT NULL, + job_title VARBINARY(255) NOT NULL, + job_timestamp BINARY(14) DEFAULT NULL, + job_params MEDIUMBLOB NOT NULL, + job_random INT UNSIGNED DEFAULT 0 NOT NULL, + job_attempts INT UNSIGNED DEFAULT 0 NOT NULL, + job_token VARBINARY(32) DEFAULT '' NOT NULL, + job_token_timestamp BINARY(14) DEFAULT NULL, + job_sha1 VARBINARY(32) DEFAULT '' NOT NULL, + INDEX job_sha1 (job_sha1), + INDEX job_cmd_token (job_cmd, job_token, job_random), + INDEX job_cmd_token_id (job_cmd, job_token, job_id), + INDEX job_cmd ( + job_cmd, + job_namespace, + job_title, + job_params(128) + ), + INDEX job_timestamp (job_timestamp), + PRIMARY KEY(job_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/slot_roles ( + role_id INT AUTO_INCREMENT NOT NULL, + role_name VARBINARY(64) NOT NULL, + UNIQUE INDEX role_name (role_name), + PRIMARY KEY(role_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/content_models ( + model_id INT AUTO_INCREMENT NOT NULL, + model_name VARBINARY(64) NOT NULL, + UNIQUE INDEX model_name (model_name), + PRIMARY KEY(model_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/categorylinks ( + cl_from INT UNSIGNED DEFAULT 0 NOT NULL, + cl_to VARBINARY(255) DEFAULT '' NOT NULL, + cl_sortkey VARBINARY(230) DEFAULT '' NOT NULL, + cl_sortkey_prefix VARBINARY(255) DEFAULT '' NOT NULL, + cl_timestamp TIMESTAMP NOT NULL, + cl_collation VARBINARY(32) DEFAULT '' NOT NULL, + cl_type ENUM('page', 'subcat', 'file') DEFAULT 'page' NOT NULL, + INDEX cl_sortkey ( + cl_to, cl_type, cl_sortkey, cl_from + ), + INDEX cl_timestamp (cl_to, cl_timestamp), + PRIMARY KEY(cl_from, cl_to) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/logging ( + log_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + log_type VARBINARY(32) DEFAULT '' NOT NULL, + log_action VARBINARY(32) DEFAULT '' NOT NULL, + log_timestamp BINARY(14) DEFAULT '19700101000000' NOT NULL, + log_actor BIGINT UNSIGNED NOT NULL, + log_namespace INT DEFAULT 0 NOT NULL, + log_title VARBINARY(255) DEFAULT '' NOT NULL, + log_page INT UNSIGNED DEFAULT NULL, + log_comment_id BIGINT UNSIGNED NOT NULL, + log_params BLOB NOT NULL, + log_deleted TINYINT UNSIGNED DEFAULT 0 NOT NULL, + INDEX log_type_time (log_type, log_timestamp), + INDEX log_actor_time (log_actor, log_timestamp), + INDEX log_page_time ( + log_namespace, log_title, log_timestamp + ), + INDEX log_times (log_timestamp), + INDEX log_actor_type_time ( + log_actor, log_type, log_timestamp + ), + INDEX log_page_id_time (log_page, log_timestamp), + INDEX log_type_action ( + log_type, log_action, log_timestamp + ), + PRIMARY KEY(log_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/uploadstash ( + us_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + us_user INT 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 BINARY(14) NOT NULL, + us_status VARCHAR(50) NOT NULL, + us_chunk_inx INT 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 ENUM( + 'UNKNOWN', 'BITMAP', 'DRAWING', 'AUDIO', + 'VIDEO', 'MULTIMEDIA', 'OFFICE', + 'TEXT', 'EXECUTABLE', 'ARCHIVE', + '3D' + ) DEFAULT NULL, + us_image_width INT UNSIGNED DEFAULT NULL, + us_image_height INT UNSIGNED DEFAULT NULL, + us_image_bits SMALLINT UNSIGNED DEFAULT NULL, + INDEX us_user (us_user), + UNIQUE INDEX us_key (us_key), + INDEX us_timestamp (us_timestamp), + PRIMARY KEY(us_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/filearchive ( + fa_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + fa_name VARBINARY(255) DEFAULT '' NOT NULL, + fa_archive_name VARBINARY(255) DEFAULT '', + fa_storage_group VARBINARY(16) DEFAULT NULL, + fa_storage_key VARBINARY(64) DEFAULT '', + fa_deleted_user INT DEFAULT NULL, + fa_deleted_timestamp BINARY(14) DEFAULT NULL, + fa_deleted_reason_id BIGINT UNSIGNED NOT NULL, + fa_size BIGINT UNSIGNED DEFAULT 0, + fa_width INT DEFAULT 0, + fa_height INT DEFAULT 0, + fa_metadata MEDIUMBLOB DEFAULT NULL, + fa_bits INT DEFAULT 0, + fa_media_type ENUM( + 'UNKNOWN', 'BITMAP', 'DRAWING', 'AUDIO', + 'VIDEO', 'MULTIMEDIA', 'OFFICE', + 'TEXT', 'EXECUTABLE', 'ARCHIVE', + '3D' + ) DEFAULT NULL, + fa_major_mime ENUM( + 'unknown', 'application', 'audio', + 'image', 'text', 'video', 'message', + 'model', 'multipart', 'chemical' + ) DEFAULT 'unknown', + fa_minor_mime VARBINARY(100) DEFAULT 'unknown', + fa_description_id BIGINT UNSIGNED NOT NULL, + fa_actor BIGINT UNSIGNED NOT NULL, + fa_timestamp BINARY(14) DEFAULT NULL, + fa_deleted TINYINT UNSIGNED DEFAULT 0 NOT NULL, + fa_sha1 VARBINARY(32) DEFAULT '' NOT NULL, + INDEX fa_name (fa_name, fa_timestamp), + INDEX fa_storage_group ( + fa_storage_group, fa_storage_key + ), + INDEX fa_deleted_timestamp (fa_deleted_timestamp), + INDEX fa_actor_timestamp (fa_actor, fa_timestamp), + INDEX fa_sha1 ( + fa_sha1(10) + ), + PRIMARY KEY(fa_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/text ( + old_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + old_text MEDIUMBLOB NOT NULL, + old_flags TINYBLOB NOT NULL, + PRIMARY KEY(old_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/oldimage ( + oi_name VARBINARY(255) DEFAULT '' NOT NULL, + oi_archive_name VARBINARY(255) DEFAULT '' NOT NULL, + oi_size BIGINT UNSIGNED DEFAULT 0 NOT NULL, + oi_width INT DEFAULT 0 NOT NULL, + oi_height INT DEFAULT 0 NOT NULL, + oi_bits INT DEFAULT 0 NOT NULL, + oi_description_id BIGINT UNSIGNED NOT NULL, + oi_actor BIGINT UNSIGNED NOT NULL, + oi_timestamp BINARY(14) NOT NULL, + oi_metadata MEDIUMBLOB NOT NULL, + oi_media_type ENUM( + 'UNKNOWN', 'BITMAP', 'DRAWING', 'AUDIO', + 'VIDEO', 'MULTIMEDIA', 'OFFICE', + 'TEXT', 'EXECUTABLE', 'ARCHIVE', + '3D' + ) DEFAULT NULL, + oi_major_mime ENUM( + 'unknown', 'application', 'audio', + 'image', 'text', 'video', 'message', + 'model', 'multipart', 'chemical' + ) DEFAULT 'unknown' NOT NULL, + oi_minor_mime VARBINARY(100) DEFAULT 'unknown' NOT NULL, + oi_deleted TINYINT UNSIGNED DEFAULT 0 NOT NULL, + oi_sha1 VARBINARY(32) DEFAULT '' NOT NULL, + INDEX oi_actor_timestamp (oi_actor, oi_timestamp), + INDEX oi_name_timestamp (oi_name, oi_timestamp), + INDEX oi_name_archive_name ( + oi_name, + oi_archive_name(14) + ), + INDEX oi_sha1 ( + oi_sha1(10) + ), + INDEX oi_timestamp (oi_timestamp) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/objectcache ( + keyname VARBINARY(255) DEFAULT '' NOT NULL, + value MEDIUMBLOB DEFAULT NULL, + exptime BINARY(14) NOT NULL, + modtoken VARCHAR(17) DEFAULT '00000000000000000' NOT NULL, + flags INT UNSIGNED DEFAULT NULL, + INDEX exptime (exptime), + PRIMARY KEY(keyname) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/block ( + bl_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + bl_target INT UNSIGNED NOT NULL, + bl_by_actor BIGINT UNSIGNED NOT NULL, + bl_reason_id BIGINT UNSIGNED NOT NULL, + bl_timestamp BINARY(14) NOT NULL, + bl_anon_only TINYINT(1) DEFAULT 0 NOT NULL, + bl_create_account TINYINT(1) DEFAULT 1 NOT NULL, + bl_enable_autoblock TINYINT(1) DEFAULT 1 NOT NULL, + bl_expiry VARBINARY(14) NOT NULL, + bl_deleted TINYINT(1) DEFAULT 0 NOT NULL, + bl_block_email TINYINT(1) DEFAULT 0 NOT NULL, + bl_allow_usertalk TINYINT(1) DEFAULT 0 NOT NULL, + bl_parent_block_id INT UNSIGNED DEFAULT NULL, + bl_sitewide TINYINT(1) DEFAULT 1 NOT NULL, + INDEX bl_timestamp (bl_timestamp), + INDEX bl_target (bl_target), + INDEX bl_expiry (bl_expiry), + INDEX bl_parent_block_id (bl_parent_block_id), + PRIMARY KEY(bl_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/block_target ( + bt_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + bt_address TINYBLOB DEFAULT NULL, + bt_user INT UNSIGNED DEFAULT NULL, + bt_user_text VARBINARY(255) DEFAULT NULL, + bt_auto TINYINT(1) DEFAULT 0 NOT NULL, + bt_range_start TINYBLOB DEFAULT NULL, + bt_range_end TINYBLOB DEFAULT NULL, + bt_ip_hex TINYBLOB DEFAULT NULL, + bt_count INT DEFAULT 0 NOT NULL, + INDEX bt_address ( + bt_address(42) + ), + INDEX bt_ip_user_text ( + bt_ip_hex(35), + bt_user_text(255) + ), + INDEX bt_range ( + bt_range_start(35), + bt_range_end(35) + ), + INDEX bt_user (bt_user), + PRIMARY KEY(bt_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/image ( + img_name VARBINARY(255) DEFAULT '' NOT NULL, + img_size BIGINT UNSIGNED DEFAULT 0 NOT NULL, + img_width INT DEFAULT 0 NOT NULL, + img_height INT DEFAULT 0 NOT NULL, + img_metadata MEDIUMBLOB NOT NULL, + img_bits INT DEFAULT 0 NOT NULL, + img_media_type ENUM( + 'UNKNOWN', 'BITMAP', 'DRAWING', 'AUDIO', + 'VIDEO', 'MULTIMEDIA', 'OFFICE', + 'TEXT', 'EXECUTABLE', 'ARCHIVE', + '3D' + ) DEFAULT NULL, + img_major_mime ENUM( + 'unknown', 'application', 'audio', + 'image', 'text', 'video', 'message', + 'model', 'multipart', 'chemical' + ) DEFAULT 'unknown' NOT NULL, + img_minor_mime VARBINARY(100) DEFAULT 'unknown' NOT NULL, + img_description_id BIGINT UNSIGNED NOT NULL, + img_actor BIGINT UNSIGNED NOT NULL, + img_timestamp BINARY(14) NOT NULL, + img_sha1 VARBINARY(32) DEFAULT '' NOT NULL, + INDEX img_actor_timestamp (img_actor, img_timestamp), + INDEX img_size (img_size), + INDEX img_timestamp (img_timestamp), + INDEX img_sha1 ( + img_sha1(10) + ), + INDEX img_media_mime ( + img_media_type, img_major_mime, img_minor_mime + ), + PRIMARY KEY(img_name) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/recentchanges ( + rc_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, + rc_timestamp BINARY(14) NOT NULL, + rc_actor BIGINT UNSIGNED NOT NULL, + rc_namespace INT DEFAULT 0 NOT NULL, + rc_title VARBINARY(255) DEFAULT '' NOT NULL, + rc_comment_id BIGINT UNSIGNED NOT NULL, + rc_minor TINYINT UNSIGNED DEFAULT 0 NOT NULL, + rc_bot TINYINT UNSIGNED DEFAULT 0 NOT NULL, + rc_new TINYINT UNSIGNED DEFAULT 0 NOT NULL, + rc_cur_id INT UNSIGNED DEFAULT 0 NOT NULL, + rc_this_oldid INT UNSIGNED DEFAULT 0 NOT NULL, + rc_last_oldid INT UNSIGNED DEFAULT 0 NOT NULL, + rc_type TINYINT UNSIGNED DEFAULT 0 NOT NULL, + rc_source VARBINARY(16) DEFAULT '' NOT NULL, + rc_patrolled TINYINT UNSIGNED DEFAULT 0 NOT NULL, + rc_ip VARBINARY(40) DEFAULT '' NOT NULL, + rc_old_len INT DEFAULT NULL, + rc_new_len INT DEFAULT NULL, + rc_deleted TINYINT UNSIGNED DEFAULT 0 NOT NULL, + rc_logid INT UNSIGNED DEFAULT 0 NOT NULL, + rc_log_type VARBINARY(255) DEFAULT NULL, + rc_log_action VARBINARY(255) DEFAULT NULL, + rc_params BLOB DEFAULT NULL, + INDEX rc_timestamp (rc_timestamp), + INDEX rc_namespace_title_timestamp ( + rc_namespace, rc_title, rc_timestamp + ), + INDEX rc_cur_id (rc_cur_id), + INDEX rc_new_name_timestamp ( + rc_new, rc_namespace, rc_timestamp + ), + INDEX rc_ip (rc_ip), + INDEX rc_ns_actor (rc_namespace, rc_actor), + INDEX rc_actor (rc_actor, rc_timestamp), + INDEX rc_name_type_patrolled_timestamp ( + rc_namespace, rc_type, rc_patrolled, + rc_timestamp + ), + INDEX rc_this_oldid (rc_this_oldid), + PRIMARY KEY(rc_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/archive ( + ar_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + ar_namespace INT DEFAULT 0 NOT NULL, + ar_title VARBINARY(255) DEFAULT '' NOT NULL, + ar_comment_id BIGINT UNSIGNED NOT NULL, + ar_actor BIGINT UNSIGNED NOT NULL, + ar_timestamp BINARY(14) NOT NULL, + ar_minor_edit TINYINT DEFAULT 0 NOT NULL, + ar_rev_id INT UNSIGNED NOT NULL, + ar_deleted TINYINT UNSIGNED DEFAULT 0 NOT NULL, + ar_len INT UNSIGNED DEFAULT NULL, + ar_page_id INT UNSIGNED DEFAULT NULL, + ar_parent_id INT UNSIGNED DEFAULT NULL, + ar_sha1 VARBINARY(32) DEFAULT '' NOT NULL, + INDEX ar_name_title_timestamp ( + ar_namespace, ar_title, ar_timestamp + ), + INDEX ar_actor_timestamp (ar_actor, ar_timestamp), + UNIQUE INDEX ar_revid_uniq (ar_rev_id), + PRIMARY KEY(ar_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/page ( + page_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + page_namespace INT NOT NULL, + page_title VARBINARY(255) NOT NULL, + page_is_redirect TINYINT UNSIGNED DEFAULT 0 NOT NULL, + page_is_new TINYINT UNSIGNED DEFAULT 0 NOT NULL, + page_random DOUBLE PRECISION UNSIGNED NOT NULL, + page_touched BINARY(14) NOT NULL, + page_links_updated BINARY(14) DEFAULT NULL, + page_latest INT UNSIGNED NOT NULL, + page_len INT UNSIGNED NOT NULL, + page_content_model VARBINARY(32) DEFAULT NULL, + page_lang VARBINARY(35) DEFAULT NULL, + UNIQUE INDEX page_name_title (page_namespace, page_title), + INDEX page_random (page_random), + INDEX page_len (page_len), + INDEX page_redirect_namespace_len ( + page_is_redirect, page_namespace, + page_len + ), + PRIMARY KEY(page_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/user ( + user_id INT UNSIGNED AUTO_INCREMENT NOT NULL, + user_name VARBINARY(255) DEFAULT '' NOT NULL, + user_real_name VARBINARY(255) DEFAULT '' NOT NULL, + user_password TINYBLOB NOT NULL, + user_newpassword TINYBLOB NOT NULL, + user_newpass_time BINARY(14) DEFAULT NULL, + user_email TINYTEXT NOT NULL, + user_touched BINARY(14) NOT NULL, + user_token BINARY(32) DEFAULT '' NOT NULL, + user_email_authenticated BINARY(14) DEFAULT NULL, + user_email_token BINARY(32) DEFAULT NULL, + user_email_token_expires BINARY(14) DEFAULT NULL, + user_registration BINARY(14) DEFAULT NULL, + user_editcount INT UNSIGNED DEFAULT NULL, + user_password_expires VARBINARY(14) DEFAULT NULL, + user_is_temp TINYINT(1) DEFAULT 0 NOT NULL, + UNIQUE INDEX user_name (user_name), + INDEX user_email_token (user_email_token), + INDEX user_email ( + user_email(50) + ), + PRIMARY KEY(user_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/user_autocreate_serial ( + uas_shard INT UNSIGNED NOT NULL, + uas_year SMALLINT UNSIGNED NOT NULL, + uas_value INT UNSIGNED NOT NULL, + PRIMARY KEY(uas_shard, uas_year) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/revision ( + rev_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, + rev_page INT UNSIGNED NOT NULL, + rev_comment_id BIGINT UNSIGNED NOT NULL, + rev_actor BIGINT UNSIGNED NOT NULL, + rev_timestamp BINARY(14) NOT NULL, + rev_minor_edit TINYINT UNSIGNED DEFAULT 0 NOT NULL, + rev_deleted TINYINT UNSIGNED DEFAULT 0 NOT NULL, + rev_len INT UNSIGNED DEFAULT NULL, + rev_parent_id BIGINT UNSIGNED DEFAULT NULL, + rev_sha1 VARBINARY(32) DEFAULT '' NOT NULL, + INDEX rev_timestamp (rev_timestamp), + INDEX rev_page_timestamp (rev_page, rev_timestamp), + INDEX rev_actor_timestamp (rev_actor, rev_timestamp, rev_id), + INDEX rev_page_actor_timestamp ( + rev_page, rev_actor, rev_timestamp + ), + PRIMARY KEY(rev_id) +) /*$wgDBTableOptions*/; + + +CREATE TABLE /*_*/searchindex ( + si_page INT UNSIGNED NOT NULL, + si_title MEDIUMTEXT NOT NULL, + si_text MEDIUMTEXT NOT NULL, + FULLTEXT INDEX si_title (si_title), + FULLTEXT INDEX si_text (si_text), + PRIMARY KEY(si_page) +) ENGINE = MyISAM DEFAULT CHARSET = utf8mb4; + + +CREATE TABLE /*_*/linktarget ( + lt_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, + lt_namespace INT NOT NULL, + lt_title VARBINARY(255) NOT NULL, + UNIQUE INDEX lt_namespace_title (lt_namespace, lt_title), + PRIMARY KEY(lt_id) +) /*$wgDBTableOptions*/; diff --git a/sql/postgres/patch-block_target.sql b/sql/postgres/patch-block_target.sql new file mode 100644 index 000000000000..00309e4371af --- /dev/null +++ b/sql/postgres/patch-block_target.sql @@ -0,0 +1,48 @@ + +CREATE TABLE block ( + bl_id SERIAL NOT NULL, + bl_target INT NOT NULL, + bl_by_actor BIGINT NOT NULL, + bl_reason_id BIGINT NOT NULL, + bl_timestamp TIMESTAMPTZ 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 TIMESTAMPTZ 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 INT DEFAULT NULL, + bl_sitewide SMALLINT DEFAULT 1 NOT NULL, + PRIMARY KEY(bl_id) +); + +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 SERIAL NOT NULL, + bt_address TEXT DEFAULT NULL, + bt_user INT DEFAULT NULL, + bt_user_text TEXT DEFAULT NULL, + bt_auto SMALLINT DEFAULT 0 NOT NULL, + bt_range_start TEXT DEFAULT NULL, + bt_range_end TEXT DEFAULT NULL, + bt_ip_hex TEXT DEFAULT NULL, + bt_count INT DEFAULT 0 NOT NULL, + PRIMARY KEY(bt_id) +); + +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/postgres/patch-categorylinks-pk.sql b/sql/postgres/patch-categorylinks-pk.sql new file mode 100644 index 000000000000..b88bb79f425e --- /dev/null +++ b/sql/postgres/patch-categorylinks-pk.sql @@ -0,0 +1,3 @@ +DROP INDEX IF EXISTS cl_from; +ALTER TABLE categorylinks + ADD PRIMARY KEY (cl_from, cl_to); diff --git a/sql/postgres/patch-change_tag-ct_rc_id.sql b/sql/postgres/patch-change_tag-ct_rc_id.sql new file mode 100644 index 000000000000..6f1cd797f3aa --- /dev/null +++ b/sql/postgres/patch-change_tag-ct_rc_id.sql @@ -0,0 +1,5 @@ +-- 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 +ALTER TABLE change_tag ALTER ct_rc_id TYPE BIGINT;
\ No newline at end of file diff --git a/sql/postgres/patch-drop-cl_collation_ext.sql b/sql/postgres/patch-drop-cl_collation_ext.sql new file mode 100644 index 000000000000..d87903453afb --- /dev/null +++ b/sql/postgres/patch-drop-cl_collation_ext.sql @@ -0,0 +1,5 @@ +-- 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 +DROP INDEX cl_collation_ext; diff --git a/sql/postgres/patch-drop-rev_page_id.sql b/sql/postgres/patch-drop-rev_page_id.sql new file mode 100644 index 000000000000..eeaeffccea9a --- /dev/null +++ b/sql/postgres/patch-drop-rev_page_id.sql @@ -0,0 +1,5 @@ +-- 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;
\ No newline at end of file diff --git a/sql/postgres/patch-externallinks-drop-el_to.sql b/sql/postgres/patch-externallinks-drop-el_to.sql new file mode 100644 index 000000000000..db90fc7d962a --- /dev/null +++ b/sql/postgres/patch-externallinks-drop-el_to.sql @@ -0,0 +1,14 @@ +-- 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 +DROP INDEX el_to; +DROP INDEX el_index; +DROP INDEX el_index_60; +DROP INDEX el_from_index_60; +ALTER TABLE externallinks +DROP el_to; +ALTER TABLE externallinks +DROP el_index; +ALTER TABLE externallinks +DROP el_index_60;
\ No newline at end of file diff --git a/sql/postgres/patch-externallinks-el_to_default.sql b/sql/postgres/patch-externallinks-el_to_default.sql new file mode 100644 index 000000000000..9937c5c6dd5b --- /dev/null +++ b/sql/postgres/patch-externallinks-el_to_default.sql @@ -0,0 +1,14 @@ +-- 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 +ALTER TABLE externallinks ALTER el_to +SET DEFAULT ''; +ALTER TABLE externallinks ALTER el_to +DROP NOT NULL; +ALTER TABLE externallinks ALTER el_index +SET DEFAULT ''; +ALTER TABLE externallinks ALTER el_index +DROP NOT NULL; +ALTER TABLE externallinks ALTER el_index_60 +SET DEFAULT '';
\ No newline at end of file diff --git a/sql/postgres/patch-externallinks-el_to_path.sql b/sql/postgres/patch-externallinks-el_to_path.sql new file mode 100644 index 000000000000..cc41845570a1 --- /dev/null +++ b/sql/postgres/patch-externallinks-el_to_path.sql @@ -0,0 +1,11 @@ +-- 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; +ALTER TABLE externallinks +ADD el_to_domain_index TEXT DEFAULT '' NOT NULL; +ALTER TABLE externallinks +ADD el_to_path TEXT DEFAULT NULL; +CREATE INDEX el_to_domain_index_to_path ON externallinks (el_to_domain_index, el_to_path); +CREATE INDEX el_from ON externallinks (el_from);
\ No newline at end of file diff --git a/sql/postgres/patch-filearchive-fa_size_to_bigint.sql b/sql/postgres/patch-filearchive-fa_size_to_bigint.sql new file mode 100644 index 000000000000..df282d5ca67f --- /dev/null +++ b/sql/postgres/patch-filearchive-fa_size_to_bigint.sql @@ -0,0 +1,5 @@ +-- 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 +ALTER TABLE filearchive ALTER fa_size TYPE BIGINT;
\ No newline at end of file diff --git a/sql/postgres/patch-image-img_size_to_bigint.sql b/sql/postgres/patch-image-img_size_to_bigint.sql new file mode 100644 index 000000000000..bb036d867a29 --- /dev/null +++ b/sql/postgres/patch-image-img_size_to_bigint.sql @@ -0,0 +1,5 @@ +-- 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 +ALTER TABLE image ALTER img_size TYPE BIGINT;
\ No newline at end of file diff --git a/sql/postgres/patch-iwlinks-drop-iwl_prefix_from_title.sql b/sql/postgres/patch-iwlinks-drop-iwl_prefix_from_title.sql new file mode 100644 index 000000000000..9bb9ad801463 --- /dev/null +++ b/sql/postgres/patch-iwlinks-drop-iwl_prefix_from_title.sql @@ -0,0 +1,5 @@ +-- 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 +DROP INDEX iwl_prefix_from_title; diff --git a/sql/postgres/patch-iwlinks-pk.sql b/sql/postgres/patch-iwlinks-pk.sql new file mode 100644 index 000000000000..68c82b432a80 --- /dev/null +++ b/sql/postgres/patch-iwlinks-pk.sql @@ -0,0 +1,8 @@ +DROP INDEX IF EXISTS iwl_from; +DROP INDEX IF EXISTS iwl_prefix_title_from; +DROP INDEX IF EXISTS iwl_prefix_from_title; +ALTER TABLE iwlinks + ADD PRIMARY KEY (iwl_from, iwl_prefix, iwl_title); + +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/postgres/patch-l10n_cache-pk.sql b/sql/postgres/patch-l10n_cache-pk.sql new file mode 100644 index 000000000000..b94d9d14bb26 --- /dev/null +++ b/sql/postgres/patch-l10n_cache-pk.sql @@ -0,0 +1,3 @@ +DROP INDEX IF EXISTS l10n_cache_lc_lang_key; +ALTER TABLE l10n_cache + ADD PRIMARY KEY (lc_lang, lc_key); diff --git a/sql/postgres/patch-langlinks-pk.sql b/sql/postgres/patch-langlinks-pk.sql new file mode 100644 index 000000000000..1a345a5fd5cf --- /dev/null +++ b/sql/postgres/patch-langlinks-pk.sql @@ -0,0 +1,3 @@ +DROP INDEX IF EXISTS langlinks_unique; +ALTER TABLE langlinks + ADD PRIMARY KEY (ll_from,ll_lang); diff --git a/sql/postgres/patch-linktarget.sql b/sql/postgres/patch-linktarget.sql new file mode 100644 index 000000000000..9181b6aa0797 --- /dev/null +++ b/sql/postgres/patch-linktarget.sql @@ -0,0 +1,8 @@ +CREATE TABLE linktarget ( + lt_id BIGSERIAL NOT NULL, + lt_namespace INT NOT NULL, + lt_title TEXT NOT NULL, + PRIMARY KEY(lt_id) +); + +CREATE UNIQUE INDEX lt_namespace_title ON linktarget (lt_namespace, lt_title); diff --git a/sql/postgres/patch-module_deps-pk.sql b/sql/postgres/patch-module_deps-pk.sql new file mode 100644 index 000000000000..f269f6f03a58 --- /dev/null +++ b/sql/postgres/patch-module_deps-pk.sql @@ -0,0 +1,3 @@ +DROP INDEX IF EXISTS md_module_skin; +ALTER TABLE module_deps + ADD PRIMARY KEY (md_module, md_skin); diff --git a/sql/postgres/patch-objectcache-modtoken.sql b/sql/postgres/patch-objectcache-modtoken.sql new file mode 100644 index 000000000000..4fb2a325baec --- /dev/null +++ b/sql/postgres/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 modtoken VARCHAR(17) DEFAULT '00000000000000000' NOT NULL; +ALTER TABLE objectcache +ADD flags INT DEFAULT NULL;
\ No newline at end of file diff --git a/sql/postgres/patch-objectcache_keyname-pk.sql b/sql/postgres/patch-objectcache_keyname-pk.sql new file mode 100644 index 000000000000..e44b3220f55b --- /dev/null +++ b/sql/postgres/patch-objectcache_keyname-pk.sql @@ -0,0 +1,4 @@ +ALTER TABLE objectcache + DROP CONSTRAINT objectcache_keyname_key, + ADD PRIMARY KEY (keyname), + ADD DEFAULT ''; diff --git a/sql/postgres/patch-oldimage-oi_size_to_bigint.sql b/sql/postgres/patch-oldimage-oi_size_to_bigint.sql new file mode 100644 index 000000000000..39ba403324a1 --- /dev/null +++ b/sql/postgres/patch-oldimage-oi_size_to_bigint.sql @@ -0,0 +1,5 @@ +-- 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 +ALTER TABLE oldimage ALTER oi_size TYPE BIGINT;
\ No newline at end of file diff --git a/sql/postgres/patch-pagelinks-drop-pl_title.sql b/sql/postgres/patch-pagelinks-drop-pl_title.sql new file mode 100644 index 000000000000..61330c70bbef --- /dev/null +++ b/sql/postgres/patch-pagelinks-drop-pl_title.sql @@ -0,0 +1,18 @@ +-- 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 +DROP INDEX pl_namespace; +DROP INDEX pl_backlinks_namespace; +ALTER TABLE pagelinks + DROP CONSTRAINT pagelinks_pkey; +ALTER TABLE pagelinks + DROP pl_namespace; +ALTER TABLE pagelinks + DROP pl_title; +ALTER TABLE pagelinks + ALTER pl_target_id +SET + NOT NULL; +ALTER TABLE pagelinks + ADD PRIMARY KEY (pl_from, pl_target_id); diff --git a/sql/postgres/patch-pagelinks-target_id.sql b/sql/postgres/patch-pagelinks-target_id.sql new file mode 100644 index 000000000000..1090ca85006c --- /dev/null +++ b/sql/postgres/patch-pagelinks-target_id.sql @@ -0,0 +1,8 @@ +-- 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 +ALTER TABLE pagelinks +ADD pl_target_id BIGINT DEFAULT NULL; +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/postgres/patch-querycache_info-pk.sql b/sql/postgres/patch-querycache_info-pk.sql new file mode 100644 index 000000000000..4247a09d3b7a --- /dev/null +++ b/sql/postgres/patch-querycache_info-pk.sql @@ -0,0 +1,3 @@ +ALTER TABLE querycache_info + DROP CONSTRAINT querycache_info_qci_type_key, + ADD PRIMARY KEY (qci_type); diff --git a/sql/postgres/patch-recentchanges-rc_id-bigint.sql b/sql/postgres/patch-recentchanges-rc_id-bigint.sql new file mode 100644 index 000000000000..4ad0ece047e7 --- /dev/null +++ b/sql/postgres/patch-recentchanges-rc_id-bigint.sql @@ -0,0 +1,5 @@ +-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. +-- Source: maintenance/abstractSchemaChanges/patch-recentchanges-rc_id-bigint.json +-- Do not modify this file directly. +-- See https://www.mediawiki.org/wiki/Manual:Schema_changes +ALTER TABLE recentchanges ALTER rc_id TYPE BIGINT;
\ No newline at end of file diff --git a/sql/postgres/patch-recentchanges-rc_new_name_timestamp.sql b/sql/postgres/patch-recentchanges-rc_new_name_timestamp.sql new file mode 100644 index 000000000000..97da1a5ad11e --- /dev/null +++ b/sql/postgres/patch-recentchanges-rc_new_name_timestamp.sql @@ -0,0 +1,5 @@ +-- 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 +ALTER INDEX new_name_timestamp RENAME TO rc_new_name_timestamp;
\ No newline at end of file diff --git a/sql/postgres/patch-revision-cleanup.sql b/sql/postgres/patch-revision-cleanup.sql new file mode 100644 index 000000000000..483d4b1ecfaa --- /dev/null +++ b/sql/postgres/patch-revision-cleanup.sql @@ -0,0 +1,14 @@ +-- 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 +ALTER TABLE revision + ALTER rev_id TYPE BIGINT; +ALTER TABLE revision + ALTER rev_comment_id + DROP DEFAULT; +ALTER TABLE revision + ALTER rev_actor + DROP DEFAULT; +ALTER TABLE revision + ALTER rev_parent_id TYPE BIGINT; diff --git a/sql/postgres/patch-searchindex-pk-titlelength.sql b/sql/postgres/patch-searchindex-pk-titlelength.sql new file mode 100644 index 000000000000..cee04e5b2aa9 --- /dev/null +++ b/sql/postgres/patch-searchindex-pk-titlelength.sql @@ -0,0 +1,12 @@ +-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. +-- Source: maintenance/abstractSchemaChanges/patch-searchindex-innodb-pk-titlelength.json +-- Do not modify this file directly. +-- See https://www.mediawiki.org/wiki/Manual:Schema_changes +DROP INDEX si_page; +ALTER TABLE searchindex + ALTER si_title + DROP DEFAULT; +ALTER TABLE searchindex + ALTER si_title TYPE TEXT; +ALTER TABLE searchindex + ADD PRIMARY KEY (si_page); diff --git a/sql/postgres/patch-searchindex-table.sql b/sql/postgres/patch-searchindex-table.sql new file mode 100644 index 000000000000..b67e3ee3972b --- /dev/null +++ b/sql/postgres/patch-searchindex-table.sql @@ -0,0 +1,12 @@ + +CREATE TABLE searchindex ( + si_page INT NOT NULL, + si_title VARCHAR(255) DEFAULT '' NOT NULL, + si_text TEXT NOT NULL +); + +CREATE UNIQUE INDEX si_page ON searchindex (si_page); + +CREATE INDEX si_title ON searchindex (si_title); + +CREATE INDEX si_text ON searchindex (si_text); diff --git a/sql/postgres/patch-sites-drop_indexes.sql b/sql/postgres/patch-sites-drop_indexes.sql new file mode 100644 index 000000000000..351756a420a2 --- /dev/null +++ b/sql/postgres/patch-sites-drop_indexes.sql @@ -0,0 +1,11 @@ +-- 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 +DROP INDEX site_type; +DROP INDEX site_group; +DROP INDEX site_source; +DROP INDEX site_language; +DROP INDEX site_protocol; +DROP INDEX site_domain; +DROP INDEX site_forward; diff --git a/sql/postgres/patch-templatelinks-drop-tl_title.sql b/sql/postgres/patch-templatelinks-drop-tl_title.sql new file mode 100644 index 000000000000..4678d22717a6 --- /dev/null +++ b/sql/postgres/patch-templatelinks-drop-tl_title.sql @@ -0,0 +1,6 @@ +DROP INDEX IF EXISTS tl_namespace; +DROP INDEX IF EXISTS tl_backlinks_namespace; +ALTER TABLE templatelinks +DROP tl_namespace; +ALTER TABLE templatelinks +DROP tl_title; diff --git a/sql/postgres/patch-templatelinks-target_id.sql b/sql/postgres/patch-templatelinks-target_id.sql new file mode 100644 index 000000000000..97ffddfd9003 --- /dev/null +++ b/sql/postgres/patch-templatelinks-target_id.sql @@ -0,0 +1,8 @@ +-- 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 +ALTER TABLE templatelinks +ADD tl_target_id BIGINT DEFAULT NULL; +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/postgres/patch-testrun.sql b/sql/postgres/patch-testrun.sql new file mode 100644 index 000000000000..a131b5dafc2a --- /dev/null +++ b/sql/postgres/patch-testrun.sql @@ -0,0 +1,30 @@ +-- +-- Optional tables for parserTests recording mode +-- With --record option, success data will be saved to these tables, +-- and comparisons of what's changed from the previous run will be +-- displayed at the end of each run. +-- +-- This file is for the Postgres version of the tables +-- + +-- Note: "if exists" will not work on older versions of Postgres +DROP TABLE IF EXISTS testitem; +DROP TABLE IF EXISTS testrun; +DROP SEQUENCE IF EXISTS testrun_id_seq; + +CREATE SEQUENCE testrun_id_seq; +CREATE TABLE testrun ( + tr_id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('testrun_id_seq'), + tr_date TIMESTAMPTZ, + tr_mw_version TEXT, + tr_php_version TEXT, + tr_db_version TEXT, + tr_uname TEXT +); + +CREATE TABLE testitem ( + ti_run INTEGER NOT NULL REFERENCES testrun(tr_id) ON DELETE CASCADE, + ti_name TEXT NOT NULL, + ti_success SMALLINT NOT NULL +); +CREATE UNIQUE INDEX testitem_uniq ON testitem(ti_run, ti_name); diff --git a/sql/postgres/patch-uploadstash-us_size_to_bigint.sql b/sql/postgres/patch-uploadstash-us_size_to_bigint.sql new file mode 100644 index 000000000000..f8618a310118 --- /dev/null +++ b/sql/postgres/patch-uploadstash-us_size_to_bigint.sql @@ -0,0 +1,5 @@ +-- 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 +ALTER TABLE uploadstash ALTER us_size TYPE BIGINT;
\ No newline at end of file diff --git a/sql/postgres/patch-user-user_is_temp.sql b/sql/postgres/patch-user-user_is_temp.sql new file mode 100644 index 000000000000..7b84a93fca18 --- /dev/null +++ b/sql/postgres/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 user_is_temp SMALLINT DEFAULT 0 NOT NULL;
\ No newline at end of file diff --git a/sql/postgres/patch-user_autocreate_serial-uas_year.sql b/sql/postgres/patch-user_autocreate_serial-uas_year.sql new file mode 100644 index 000000000000..d00601b11f77 --- /dev/null +++ b/sql/postgres/patch-user_autocreate_serial-uas_year.sql @@ -0,0 +1,10 @@ +-- 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 +ALTER TABLE user_autocreate_serial + DROP CONSTRAINT user_autocreate_serial_pkey; +ALTER TABLE user_autocreate_serial + ADD uas_year SMALLINT NOT NULL; +ALTER TABLE user_autocreate_serial + ADD PRIMARY KEY (uas_shard, uas_year); diff --git a/sql/postgres/patch-user_autocreate_serial.sql b/sql/postgres/patch-user_autocreate_serial.sql new file mode 100644 index 000000000000..d0377260d3c8 --- /dev/null +++ b/sql/postgres/patch-user_autocreate_serial.sql @@ -0,0 +1,5 @@ +CREATE TABLE user_autocreate_serial ( + uas_shard INT NOT NULL, + uas_value INT NOT NULL, + PRIMARY KEY(uas_shard) +); diff --git a/sql/postgres/patch-user_properties-pk.sql b/sql/postgres/patch-user_properties-pk.sql new file mode 100644 index 000000000000..c6085947de08 --- /dev/null +++ b/sql/postgres/patch-user_properties-pk.sql @@ -0,0 +1,3 @@ +DROP INDEX IF EXISTS user_properties_user_property; +ALTER TABLE user_properties + ADD PRIMARY KEY (up_user, up_property); diff --git a/sql/postgres/tables-generated.sql b/sql/postgres/tables-generated.sql new file mode 100644 index 000000000000..dc5176ee900b --- /dev/null +++ b/sql/postgres/tables-generated.sql @@ -0,0 +1,940 @@ +-- 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 TEXT NOT NULL, + si_key TEXT NOT NULL, + si_site INT 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 TEXT DEFAULT NULL, + PRIMARY KEY(ul_key) +); + + +CREATE TABLE actor ( + actor_id BIGSERIAL NOT NULL, + actor_user INT DEFAULT NULL, + actor_name TEXT NOT NULL, + PRIMARY KEY(actor_id) +); + +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 INT DEFAULT 0 NOT NULL, + ufg_group TEXT DEFAULT '' NOT NULL, + PRIMARY KEY(ufg_user, ufg_group) +); + + +CREATE TABLE bot_passwords ( + bp_user INT NOT NULL, + bp_app_id TEXT NOT NULL, + bp_password TEXT NOT NULL, + bp_token TEXT DEFAULT '' NOT NULL, + bp_restrictions TEXT NOT NULL, + bp_grants TEXT NOT NULL, + PRIMARY KEY(bp_user, bp_app_id) +); + + +CREATE TABLE comment ( + comment_id BIGSERIAL NOT NULL, + comment_hash INT NOT NULL, + comment_text TEXT NOT NULL, + comment_data TEXT DEFAULT NULL, + PRIMARY KEY(comment_id) +); + +CREATE INDEX comment_hash ON comment (comment_hash); + + +CREATE TABLE slots ( + slot_revision_id BIGINT NOT NULL, + slot_role_id SMALLINT NOT NULL, + slot_content_id BIGINT NOT NULL, + slot_origin BIGINT 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 INT NOT NULL, + ss_total_edits BIGINT DEFAULT NULL, + ss_good_articles BIGINT DEFAULT NULL, + ss_total_pages BIGINT DEFAULT NULL, + ss_users BIGINT DEFAULT NULL, + ss_active_users BIGINT DEFAULT NULL, + ss_images BIGINT DEFAULT NULL, + PRIMARY KEY(ss_row_id) +); + + +CREATE TABLE user_properties ( + up_user INT NOT NULL, + up_property TEXT NOT NULL, + up_value TEXT DEFAULT NULL, + PRIMARY KEY(up_user, up_property) +); + +CREATE INDEX up_property ON user_properties (up_property); + + +CREATE TABLE log_search ( + ls_field TEXT NOT NULL, + ls_value VARCHAR(255) NOT NULL, + ls_log_id INT 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 SERIAL NOT NULL, + ct_rc_id BIGINT DEFAULT NULL, + ct_log_id INT DEFAULT NULL, + ct_rev_id INT DEFAULT NULL, + ct_params TEXT DEFAULT NULL, + ct_tag_id INT NOT NULL, + PRIMARY KEY(ct_id) +); + +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 BIGSERIAL NOT NULL, + content_size INT NOT NULL, + content_sha1 TEXT NOT NULL, + content_model SMALLINT NOT NULL, + content_address TEXT NOT NULL, + PRIMARY KEY(content_id) +); + + +CREATE TABLE l10n_cache ( + lc_lang TEXT NOT NULL, + lc_key VARCHAR(255) NOT NULL, + lc_value TEXT NOT NULL, + PRIMARY KEY(lc_lang, lc_key) +); + + +CREATE TABLE module_deps ( + md_module TEXT NOT NULL, + md_skin TEXT NOT NULL, + md_deps TEXT NOT NULL, + PRIMARY KEY(md_module, md_skin) +); + + +CREATE TABLE redirect ( + rd_from INT DEFAULT 0 NOT NULL, + rd_namespace INT DEFAULT 0 NOT NULL, + rd_title TEXT DEFAULT '' NOT NULL, + rd_interwiki VARCHAR(32) DEFAULT NULL, + rd_fragment TEXT DEFAULT NULL, + PRIMARY KEY(rd_from) +); + +CREATE INDEX rd_ns_title ON redirect (rd_namespace, rd_title, rd_from); + + +CREATE TABLE pagelinks ( + pl_from INT DEFAULT 0 NOT NULL, + pl_target_id BIGINT NOT NULL, + pl_from_namespace INT 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 INT DEFAULT 0 NOT NULL, + tl_target_id BIGINT NOT NULL, + tl_from_namespace INT 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 INT DEFAULT 0 NOT NULL, + il_to TEXT DEFAULT '' NOT NULL, + il_from_namespace INT 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 INT DEFAULT 0 NOT NULL, + ll_lang TEXT DEFAULT '' NOT NULL, + ll_title TEXT DEFAULT '' NOT NULL, + PRIMARY KEY(ll_from, ll_lang) +); + +CREATE INDEX ll_lang ON langlinks (ll_lang, ll_title); + + +CREATE TABLE iwlinks ( + iwl_from INT DEFAULT 0 NOT NULL, + iwl_prefix TEXT DEFAULT '' NOT NULL, + iwl_title TEXT 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 SERIAL NOT NULL, + cat_title TEXT NOT NULL, + cat_pages INT DEFAULT 0 NOT NULL, + cat_subcats INT DEFAULT 0 NOT NULL, + cat_files INT DEFAULT 0 NOT NULL, + PRIMARY KEY(cat_id) +); + +CREATE UNIQUE INDEX cat_title ON category (cat_title); + +CREATE INDEX cat_pages ON category (cat_pages); + + +CREATE TABLE watchlist_expiry ( + we_item INT NOT NULL, + we_expiry TIMESTAMPTZ NOT NULL, + PRIMARY KEY(we_item) +); + +CREATE INDEX we_expiry ON watchlist_expiry (we_expiry); + + +CREATE TABLE change_tag_def ( + ctd_id SERIAL NOT NULL, + ctd_name TEXT NOT NULL, + ctd_user_defined SMALLINT NOT NULL, + ctd_count BIGINT DEFAULT 0 NOT NULL, + PRIMARY KEY(ctd_id) +); + +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 INT NOT NULL, + ir_type SMALLINT NOT NULL, + ir_value INT 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 TEXT NOT NULL, qc_value INT DEFAULT 0 NOT NULL, + qc_namespace INT DEFAULT 0 NOT NULL, + qc_title TEXT DEFAULT '' NOT NULL +); + +CREATE INDEX qc_type ON querycache (qc_type, qc_value); + + +CREATE TABLE querycachetwo ( + qcc_type TEXT NOT NULL, qcc_value INT DEFAULT 0 NOT NULL, + qcc_namespace INT DEFAULT 0 NOT NULL, + qcc_title TEXT DEFAULT '' NOT NULL, + qcc_namespacetwo INT DEFAULT 0 NOT NULL, + qcc_titletwo TEXT 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 SERIAL NOT NULL, + pr_page INT NOT NULL, + pr_type TEXT NOT NULL, + pr_level TEXT NOT NULL, + pr_cascade SMALLINT NOT NULL, + pr_expiry TIMESTAMPTZ DEFAULT NULL, + PRIMARY KEY(pr_id) +); + +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 INT DEFAULT 0 NOT NULL, + ug_group TEXT DEFAULT '' NOT NULL, + ug_expiry TIMESTAMPTZ 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 TEXT DEFAULT '' NOT NULL, + qci_timestamp TIMESTAMPTZ DEFAULT '1970-01-01 00:00:00+00' NOT NULL, + PRIMARY KEY(qci_type) +); + + +CREATE TABLE watchlist ( + wl_id SERIAL NOT NULL, + wl_user INT NOT NULL, + wl_namespace INT DEFAULT 0 NOT NULL, + wl_title TEXT DEFAULT '' NOT NULL, + wl_notificationtimestamp TIMESTAMPTZ DEFAULT NULL, + PRIMARY KEY(wl_id) +); + +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 SERIAL NOT NULL, + site_global_key TEXT NOT NULL, + site_type TEXT NOT NULL, + site_group TEXT NOT NULL, + site_source TEXT NOT NULL, + site_language TEXT NOT NULL, + site_protocol TEXT NOT NULL, + site_domain VARCHAR(255) NOT NULL, + site_data TEXT NOT NULL, + site_forward SMALLINT NOT NULL, + site_config TEXT NOT NULL, + PRIMARY KEY(site_id) +); + +CREATE UNIQUE INDEX site_global_key ON sites (site_global_key); + + +CREATE TABLE user_newtalk ( + user_id INT DEFAULT 0 NOT NULL, user_ip TEXT DEFAULT '' NOT NULL, + user_last_timestamp TIMESTAMPTZ 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 TEXT NOT NULL, + iw_api TEXT 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 INT NOT NULL, + pt_title TEXT NOT NULL, + pt_user INT NOT NULL, + pt_reason_id BIGINT NOT NULL, + pt_timestamp TIMESTAMPTZ NOT NULL, + pt_expiry TIMESTAMPTZ NOT NULL, + pt_create_perm TEXT NOT NULL, + PRIMARY KEY(pt_namespace, pt_title) +); + +CREATE INDEX pt_timestamp ON protected_titles (pt_timestamp); + + +CREATE TABLE externallinks ( + el_id SERIAL NOT NULL, + el_from INT DEFAULT 0 NOT NULL, + el_to_domain_index TEXT DEFAULT '' NOT NULL, + el_to_path TEXT DEFAULT NULL, + PRIMARY KEY(el_id) +); + +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 INT DEFAULT 0 NOT NULL, + ipc_rev_timestamp TIMESTAMPTZ NOT NULL, + ipc_hex TEXT 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 INT NOT NULL, + pp_propname TEXT NOT NULL, + pp_value TEXT NOT NULL, + pp_sortkey FLOAT 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) +WHERE (pp_sortkey IS NOT NULL); + + +CREATE TABLE job ( + job_id SERIAL NOT NULL, + job_cmd TEXT DEFAULT '' NOT NULL, + job_namespace INT NOT NULL, + job_title TEXT NOT NULL, + job_timestamp TIMESTAMPTZ DEFAULT NULL, + job_params TEXT NOT NULL, + job_random INT DEFAULT 0 NOT NULL, + job_attempts INT DEFAULT 0 NOT NULL, + job_token TEXT DEFAULT '' NOT NULL, + job_token_timestamp TIMESTAMPTZ DEFAULT NULL, + job_sha1 TEXT DEFAULT '' NOT NULL, + PRIMARY KEY(job_id) +); + +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 SERIAL NOT NULL, + role_name TEXT NOT NULL, + PRIMARY KEY(role_id) +); + +CREATE UNIQUE INDEX role_name ON slot_roles (role_name); + + +CREATE TABLE content_models ( + model_id SERIAL NOT NULL, + model_name TEXT NOT NULL, + PRIMARY KEY(model_id) +); + +CREATE UNIQUE INDEX model_name ON content_models (model_name); + + +CREATE TABLE categorylinks ( + cl_from INT DEFAULT 0 NOT NULL, + cl_to TEXT DEFAULT '' NOT NULL, + cl_sortkey TEXT DEFAULT '' NOT NULL, + cl_sortkey_prefix TEXT DEFAULT '' NOT NULL, + cl_timestamp TIMESTAMPTZ NOT NULL, + cl_collation TEXT 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 SERIAL NOT NULL, + log_type TEXT DEFAULT '' NOT NULL, + log_action TEXT DEFAULT '' NOT NULL, + log_timestamp TIMESTAMPTZ DEFAULT '1970-01-01 00:00:00+00' NOT NULL, + log_actor BIGINT NOT NULL, + log_namespace INT DEFAULT 0 NOT NULL, + log_title TEXT DEFAULT '' NOT NULL, + log_page INT DEFAULT NULL, + log_comment_id BIGINT NOT NULL, + log_params TEXT NOT NULL, + log_deleted SMALLINT DEFAULT 0 NOT NULL, + PRIMARY KEY(log_id) +); + +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 TYPE US_MEDIA_TYPE_ENUM AS ENUM( + 'UNKNOWN', 'BITMAP', 'DRAWING', 'AUDIO', + 'VIDEO', 'MULTIMEDIA', 'OFFICE', + 'TEXT', 'EXECUTABLE', 'ARCHIVE', + '3D' +); + + +CREATE TABLE uploadstash ( + us_id SERIAL NOT NULL, + us_user INT 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 TIMESTAMPTZ NOT NULL, + us_status VARCHAR(50) NOT NULL, + us_chunk_inx INT DEFAULT NULL, + us_props TEXT DEFAULT NULL, + us_size BIGINT NOT NULL, + us_sha1 VARCHAR(31) NOT NULL, + us_mime VARCHAR(255) DEFAULT NULL, + us_media_type US_MEDIA_TYPE_ENUM DEFAULT NULL, + us_image_width INT DEFAULT NULL, + us_image_height INT DEFAULT NULL, + us_image_bits SMALLINT DEFAULT NULL, + PRIMARY KEY(us_id) +); + +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 SERIAL NOT NULL, + fa_name TEXT DEFAULT '' NOT NULL, + fa_archive_name TEXT DEFAULT '', + fa_storage_group TEXT DEFAULT NULL, + fa_storage_key TEXT DEFAULT '', + fa_deleted_user INT DEFAULT NULL, + fa_deleted_timestamp TIMESTAMPTZ DEFAULT NULL, + fa_deleted_reason_id BIGINT NOT NULL, + fa_size BIGINT DEFAULT 0, + fa_width INT DEFAULT 0, + fa_height INT DEFAULT 0, + fa_metadata TEXT DEFAULT NULL, + fa_bits INT DEFAULT 0, + fa_media_type TEXT DEFAULT NULL, + fa_major_mime TEXT DEFAULT 'unknown', + fa_minor_mime TEXT DEFAULT 'unknown', + fa_description_id BIGINT NOT NULL, + fa_actor BIGINT NOT NULL, + fa_timestamp TIMESTAMPTZ DEFAULT NULL, + fa_deleted SMALLINT DEFAULT 0 NOT NULL, + fa_sha1 TEXT DEFAULT '' NOT NULL, + PRIMARY KEY(fa_id) +); + +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 SERIAL NOT NULL, + old_text TEXT NOT NULL, + old_flags TEXT NOT NULL, + PRIMARY KEY(old_id) +); + + +CREATE TABLE oldimage ( + oi_name TEXT DEFAULT '' NOT NULL, oi_archive_name TEXT DEFAULT '' NOT NULL, + oi_size BIGINT DEFAULT 0 NOT NULL, oi_width INT DEFAULT 0 NOT NULL, + oi_height INT DEFAULT 0 NOT NULL, oi_bits INT DEFAULT 0 NOT NULL, + oi_description_id BIGINT NOT NULL, + oi_actor BIGINT NOT NULL, oi_timestamp TIMESTAMPTZ NOT NULL, + oi_metadata TEXT NOT NULL, oi_media_type TEXT DEFAULT NULL, + oi_major_mime TEXT DEFAULT 'unknown' NOT NULL, + oi_minor_mime TEXT DEFAULT 'unknown' NOT NULL, + oi_deleted SMALLINT DEFAULT 0 NOT NULL, + oi_sha1 TEXT 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 TEXT DEFAULT '' NOT NULL, + value TEXT DEFAULT NULL, + exptime TIMESTAMPTZ NOT NULL, + modtoken VARCHAR(17) DEFAULT '00000000000000000' NOT NULL, + flags INT DEFAULT NULL, + PRIMARY KEY(keyname) +); + +CREATE INDEX exptime ON objectcache (exptime); + + +CREATE TABLE block ( + bl_id SERIAL NOT NULL, + bl_target INT NOT NULL, + bl_by_actor BIGINT NOT NULL, + bl_reason_id BIGINT NOT NULL, + bl_timestamp TIMESTAMPTZ 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 TIMESTAMPTZ 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 INT DEFAULT NULL, + bl_sitewide SMALLINT DEFAULT 1 NOT NULL, + PRIMARY KEY(bl_id) +); + +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 SERIAL NOT NULL, + bt_address TEXT DEFAULT NULL, + bt_user INT DEFAULT NULL, + bt_user_text TEXT DEFAULT NULL, + bt_auto SMALLINT DEFAULT 0 NOT NULL, + bt_range_start TEXT DEFAULT NULL, + bt_range_end TEXT DEFAULT NULL, + bt_ip_hex TEXT DEFAULT NULL, + bt_count INT DEFAULT 0 NOT NULL, + PRIMARY KEY(bt_id) +); + +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 TEXT DEFAULT '' NOT NULL, + img_size BIGINT DEFAULT 0 NOT NULL, + img_width INT DEFAULT 0 NOT NULL, + img_height INT DEFAULT 0 NOT NULL, + img_metadata TEXT NOT NULL, + img_bits INT DEFAULT 0 NOT NULL, + img_media_type TEXT DEFAULT NULL, + img_major_mime TEXT DEFAULT 'unknown' NOT NULL, + img_minor_mime TEXT DEFAULT 'unknown' NOT NULL, + img_description_id BIGINT NOT NULL, + img_actor BIGINT NOT NULL, + img_timestamp TIMESTAMPTZ NOT NULL, + img_sha1 TEXT 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 BIGSERIAL NOT NULL, + rc_timestamp TIMESTAMPTZ NOT NULL, + rc_actor BIGINT NOT NULL, + rc_namespace INT DEFAULT 0 NOT NULL, + rc_title TEXT DEFAULT '' NOT NULL, + rc_comment_id BIGINT NOT NULL, + rc_minor SMALLINT DEFAULT 0 NOT NULL, + rc_bot SMALLINT DEFAULT 0 NOT NULL, + rc_new SMALLINT DEFAULT 0 NOT NULL, + rc_cur_id INT DEFAULT 0 NOT NULL, + rc_this_oldid INT DEFAULT 0 NOT NULL, + rc_last_oldid INT DEFAULT 0 NOT NULL, + rc_type SMALLINT DEFAULT 0 NOT NULL, + rc_source TEXT DEFAULT '' NOT NULL, + rc_patrolled SMALLINT DEFAULT 0 NOT NULL, + rc_ip TEXT DEFAULT '' NOT NULL, + rc_old_len INT DEFAULT NULL, + rc_new_len INT DEFAULT NULL, + rc_deleted SMALLINT DEFAULT 0 NOT NULL, + rc_logid INT DEFAULT 0 NOT NULL, + rc_log_type TEXT DEFAULT NULL, + rc_log_action TEXT DEFAULT NULL, + rc_params TEXT DEFAULT NULL, + PRIMARY KEY(rc_id) +); + +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 SERIAL NOT NULL, + ar_namespace INT DEFAULT 0 NOT NULL, + ar_title TEXT DEFAULT '' NOT NULL, + ar_comment_id BIGINT NOT NULL, + ar_actor BIGINT NOT NULL, + ar_timestamp TIMESTAMPTZ NOT NULL, + ar_minor_edit SMALLINT DEFAULT 0 NOT NULL, + ar_rev_id INT NOT NULL, + ar_deleted SMALLINT DEFAULT 0 NOT NULL, + ar_len INT DEFAULT NULL, + ar_page_id INT DEFAULT NULL, + ar_parent_id INT DEFAULT NULL, + ar_sha1 TEXT DEFAULT '' NOT NULL, + PRIMARY KEY(ar_id) +); + +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 SERIAL NOT NULL, + page_namespace INT NOT NULL, + page_title TEXT NOT NULL, + page_is_redirect SMALLINT DEFAULT 0 NOT NULL, + page_is_new SMALLINT DEFAULT 0 NOT NULL, + page_random FLOAT NOT NULL, + page_touched TIMESTAMPTZ NOT NULL, + page_links_updated TIMESTAMPTZ DEFAULT NULL, + page_latest INT NOT NULL, + page_len INT NOT NULL, + page_content_model TEXT DEFAULT NULL, + page_lang TEXT DEFAULT NULL, + PRIMARY KEY(page_id) +); + +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 SERIAL NOT NULL, + user_name TEXT DEFAULT '' NOT NULL, + user_real_name TEXT DEFAULT '' NOT NULL, + user_password TEXT NOT NULL, + user_newpassword TEXT NOT NULL, + user_newpass_time TIMESTAMPTZ DEFAULT NULL, + user_email TEXT NOT NULL, + user_touched TIMESTAMPTZ NOT NULL, + user_token TEXT DEFAULT '' NOT NULL, + user_email_authenticated TIMESTAMPTZ DEFAULT NULL, + user_email_token TEXT DEFAULT NULL, + user_email_token_expires TIMESTAMPTZ DEFAULT NULL, + user_registration TIMESTAMPTZ DEFAULT NULL, + user_editcount INT DEFAULT NULL, + user_password_expires TIMESTAMPTZ DEFAULT NULL, + user_is_temp SMALLINT DEFAULT 0 NOT NULL, + PRIMARY KEY(user_id) +); + +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 INT NOT NULL, + uas_year SMALLINT NOT NULL, + uas_value INT NOT NULL, + PRIMARY KEY(uas_shard, uas_year) +); + + +CREATE TABLE revision ( + rev_id BIGSERIAL NOT NULL, + rev_page INT NOT NULL, + rev_comment_id BIGINT NOT NULL, + rev_actor BIGINT NOT NULL, + rev_timestamp TIMESTAMPTZ NOT NULL, + rev_minor_edit SMALLINT DEFAULT 0 NOT NULL, + rev_deleted SMALLINT DEFAULT 0 NOT NULL, + rev_len INT DEFAULT NULL, + rev_parent_id BIGINT DEFAULT NULL, + rev_sha1 TEXT DEFAULT '' NOT NULL, + PRIMARY KEY(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 +); + + +CREATE TABLE searchindex ( + si_page INT NOT NULL, + si_title TEXT NOT NULL, + si_text TEXT 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 BIGSERIAL NOT NULL, + lt_namespace INT NOT NULL, + lt_title TEXT NOT NULL, + PRIMARY KEY(lt_id) +); + +CREATE UNIQUE INDEX lt_namespace_title ON linktarget (lt_namespace, lt_title); diff --git a/sql/postgres/tables.sql b/sql/postgres/tables.sql new file mode 100644 index 000000000000..a7c5f14eeab8 --- /dev/null +++ b/sql/postgres/tables.sql @@ -0,0 +1,48 @@ +-- SQL to create the initial tables for the MediaWiki database. +-- This is read and executed by the install script; you should +-- not have to run it by itself unless doing a manual install. +-- This is the PostgreSQL version. +-- For information about each table, please see the notes in sql/tables.json +-- Please make sure all dollar-quoting uses $mw$ at the start of the line +-- TODO: Change CHAR/SMALLINT to BOOL (still used in a non-bool fashion in PHP code) + +BEGIN; +SET client_min_messages = 'ERROR'; + +-- Tsearch2 2 stuff. Will fail if we don't have proper access to the tsearch2 tables +-- Make sure you also change patch-tsearch2funcs.sql if the funcs below change. +ALTER TABLE page ADD titlevector tsvector; +CREATE FUNCTION ts2_page_title() RETURNS TRIGGER LANGUAGE plpgsql AS +$mw$ +BEGIN +IF TG_OP = 'INSERT' THEN + NEW.titlevector = to_tsvector(REPLACE(NEW.page_title,'/',' ')); +ELSIF NEW.page_title != OLD.page_title THEN + NEW.titlevector := to_tsvector(REPLACE(NEW.page_title,'/',' ')); +END IF; +RETURN NEW; +END; +$mw$; + +CREATE TRIGGER ts2_page_title BEFORE INSERT OR UPDATE ON page + FOR EACH ROW EXECUTE PROCEDURE ts2_page_title(); + + +ALTER TABLE text ADD textvector tsvector; +CREATE FUNCTION ts2_page_text() RETURNS TRIGGER LANGUAGE plpgsql AS +$mw$ +BEGIN +IF TG_OP = 'INSERT' THEN + NEW.textvector = to_tsvector(NEW.old_text); +ELSIF NEW.old_text != OLD.old_text THEN + NEW.textvector := to_tsvector(NEW.old_text); +END IF; +RETURN NEW; +END; +$mw$; + +CREATE TRIGGER ts2_page_text BEFORE INSERT OR UPDATE ON text + FOR EACH ROW EXECUTE PROCEDURE ts2_page_text(); + +CREATE INDEX ts2_page_title ON page USING gin(titlevector); +CREATE INDEX ts2_page_text ON text USING gin(textvector); 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); diff --git a/sql/tables.json b/sql/tables.json new file mode 100644 index 000000000000..5a1bd74e0165 --- /dev/null +++ b/sql/tables.json @@ -0,0 +1,3719 @@ +[ + { + "name": "site_identifiers", + "comment": "Links local site identifiers to their corresponding site.", + "columns": [ + { + "name": "si_type", + "comment": "local key type, ie 'interwiki' or 'langlink'", + "type": "binary", + "options": { "length": 32, "notnull": true } + }, + { + "name": "si_key", + "comment": "local key value, ie 'en' or 'wiktionary'", + "type": "binary", + "options": { "length": 32, "notnull": true } + }, + { + "name": "si_site", + "comment": "Key on sites.site_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + } + ], + "indexes": [ + { "name": "si_site", "columns": [ "si_site" ], "unique": false }, + { "name": "si_key", "columns": [ "si_key" ], "unique": false } + ], + "pk": [ "si_type", "si_key" ] + }, + { + "name": "updatelog", + "comment": "A table to log updates, one text key row per update.", + "columns": [ + { + "name": "ul_key", + "type": "string", + "options": { "length": 255, "notnull": true } + }, + { + "name": "ul_value", + "type": "blob", + "options": { "length": 65530, "notnull": false } + } + ], + "indexes": [], + "pk": [ "ul_key" ] + }, + { + "name": "actor", + "comment": "The \"actor\" table associates user names or IP addresses with integers for the benefit of other tables that need to refer to either logged-in or logged-out users. If something can only ever be done by logged-in users, it can refer to the user table directly.", + "columns": [ + { + "name": "actor_id", + "comment": "Unique ID to identify each actor", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "actor_user", + "comment": "Key to user.user_id, or NULL for anonymous edits", + "type": "integer", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "actor_name", + "comment": "Text username or IP address", + "type": "binary", + "options": { "length": 255, "notnull": true } + } + ], + "indexes": [ + { "name": "actor_user", "columns": [ "actor_user" ], "unique": true }, + { "name": "actor_name", "columns": [ "actor_name" ], "unique": true } + ], + "pk": [ "actor_id" ] + }, + { + "name": "user_former_groups", + "comment": "Stores the groups the user has once belonged to. The user may still belong to these groups (check user_groups). Autopromotion of users to groups from which they were removed can be restricted by using wgAutopromoteOnce instead of wgAutopromote.", + "columns": [ + { + "name": "ufg_user", + "comment": "Key to user_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "ufg_group", + "type": "binary", + "options": { "length": 255, "notnull": true, "default": "" } + } + ], + "indexes": [], + "pk": [ "ufg_user", "ufg_group" ] + }, + { + "name": "bot_passwords", + "comment": "This table contains a user's bot passwords: passwords that allow access to the account via the API with limited rights.", + "columns": [ + { + "name": "bp_user", + "comment": "User ID obtained from CentralIdLookup.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "bp_app_id", + "comment": "Application identifier.", + "type": "binary", + "options": { "length": 32, "notnull": true } + }, + { + "name": "bp_password", + "comment": "Password hashes, like user.user_password.", + "type": "blob", + "options": { "length": 255, "notnull": true } + }, + { + "name": "bp_token", + "comment": "Like user.user_token", + "type": "binary", + "options": { "length": 32, "notnull": true, "default": "", "fixed": true } + }, + { + "name": "bp_restrictions", + "comment": "JSON blob for MWRestrictions", + "type": "blob", + "options": { "length": 65535, "notnull": true } + }, + { + "name": "bp_grants", + "comment": "Grants allowed to the account when authenticated with this bot-password", + "type": "blob", + "options": { "length": 65535, "notnull": true } + } + ], + "indexes": [], + "pk": [ "bp_user", "bp_app_id" ] + }, + { + "name": "comment", + "comment": "Edits, blocks, and other actions typically have a textual comment describing the action. They are stored here to reduce the size of the main tables, and to allow for deduplication. Deduplication is currently best-effort to avoid locking on inserts that would be required for strict deduplication. There MAY be multiple rows with the same comment_text and comment_data.", + "columns": [ + { + "name": "comment_id", + "comment": "Unique ID to identify each comment", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "comment_hash", + "comment": "Hash of comment_text and comment_data, for deduplication", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "comment_text", + "comment": "Text comment summarizing the change. This text is shown in the history and other changes lists, rendered in a subset of wiki markup by MediaWiki\\CommentFormatter\\CommentFormatter::format(). Size limits are enforced at the application level, and should take care to crop UTF-8 strings appropriately.", + "type": "blob", + "options": { "length": 65535, "notnull": true } + }, + { + "name": "comment_data", + "comment": "JSON data, intended for localizing auto-generated comments. This holds structured data that is intended to be used to provide localized versions of automatically-generated comments. When not empty, comment_text should be the generated comment localized using the wiki's content language.", + "type": "blob", + "options": { "length": 65535, "notnull": false } + } + ], + "indexes": [ + { "name": "comment_hash", "columns": [ "comment_hash" ], "unique": false } + ], + "pk": [ "comment_id" ] + }, + { + "name": "slots", + "comment": "Slots represent an n:m relation between revisions and content objects. A content object can have a specific \"role\" in one or more revisions. Each revision can have multiple content objects, each having a different role.", + "columns": [ + { + "name": "slot_revision_id", + "comment": "reference to rev_id or ar_rev_id", + "type": "bigint", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "slot_role_id", + "comment": "reference to role_id", + "type": "smallint", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "slot_content_id", + "comment": "reference to content_id", + "type": "bigint", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "slot_origin", + "comment": "The revision ID of the revision that originated the slot's content. To find revisions that changed slots, look for slot_origin = slot_revision_id. TODO: Is that actually true? Rollback seems to violate it by setting slot_origin to an older rev_id. Undeletions could result in the same situation.", + "type": "bigint", + "options": { "unsigned": true, "notnull": true } + } + ], + "indexes": [ + { + "name": "slot_revision_origin_role", + "columns": [ "slot_revision_id", "slot_origin", "slot_role_id" ], + "comment": "Index for finding revisions that modified a specific slot", + "unique": false + } + ], + "pk": [ "slot_revision_id", "slot_role_id" ] + }, + { + "name": "site_stats", + "comment": "Contains a single row with some aggregate info on the state of the site.", + "columns": [ + { + "name": "ss_row_id", + "comment": "The single row should contain 1 here.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "ss_total_edits", + "comment": "Total number of edits performed.", + "type": "bigint", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ss_good_articles", + "comment": "See SiteStatsInit::articles().", + "type": "bigint", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ss_total_pages", + "comment": "Total pages, theoretically equal to SELECT COUNT(*) FROM page.", + "type": "bigint", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ss_users", + "comment": "Number of users, theoretically equal to SELECT COUNT(*) FROM user.", + "type": "bigint", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ss_active_users", + "comment": "Number of users that still edit.", + "type": "bigint", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ss_images", + "comment": "Number of images, equivalent to SELECT COUNT(*) FROM image.", + "type": "bigint", + "options": { "unsigned": true, "notnull": false, "default": null } + } + ], + "indexes": [], + "pk": [ "ss_row_id" ] + }, + { + "name": "user_properties", + "comment": "User preferences and perhaps other fun stuff. :) Replaces the old user.user_options blob, with a couple nice properties: 1) We only store non-default settings, so changes to the defaults are now reflected for everybody, not just new accounts. 2) We can more easily do bulk lookups, statistics, or modifications of saved options since it's a sensible table structure.", + "columns": [ + { + "name": "up_user", + "comment": "Foreign key to user.user_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "up_property", + "comment": "Name of the option being saved. This is indexed for bulk lookup.", + "type": "binary", + "options": { "length": 255, "notnull": true } + }, + { + "name": "up_value", + "comment": "Property value as a string.", + "type": "blob", + "options": { "length": 65530, "notnull": false } + } + ], + "indexes": [ + { "name": "up_property", "columns": [ "up_property" ], "unique": false } + ], + "pk": [ "up_user", "up_property" ] + }, + { + "name": "log_search", + "columns": [ + { + "name": "ls_field", + "comment": "The type of ID (rev ID, log ID, rev timestamp, username)", + "type": "binary", + "options": { "length": 32, "notnull": true } + }, + { + "name": "ls_value", + "comment": "The value of the ID", + "type": "string", + "options": { "length": 255, "notnull": true } + }, + { + "name": "ls_log_id", + "comment": "Key to log_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "default": 0 } + } + ], + "indexes": [ + { "name": "ls_log_id", "columns": [ "ls_log_id" ], "unique": false } + ], + "pk": [ "ls_field", "ls_value", "ls_log_id" ] + }, + { + "name": "change_tag", + "comment": "A table to track tags for revisions, logs and recent changes", + "columns": [ + { + "name": "ct_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "ct_rc_id", + "comment": "RCID for the change", + "type": "bigint", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_log_id", + "comment": "LOGID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_rev_id", + "comment": "REVID for the change", + "type": "integer", + "options": { "unsigned": true, "notnull": false, "default": null } + }, + { + "name": "ct_params", + "comment": "Parameters for the tag; used by some extensions", + "type": "blob", + "options": { "length": 65530, "notnull": false, "default": null } + }, + { + "name": "ct_tag_id", + "comment": "Foreign key to change_tag_def row", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + } + ], + "indexes": [ + { "name": "ct_rc_tag_id", "columns": [ "ct_rc_id", "ct_tag_id" ], "unique": true }, + { "name": "ct_log_tag_id", "columns": [ "ct_log_id", "ct_tag_id" ], "unique": true }, + { "name": "ct_rev_tag_id", "columns": [ "ct_rev_id", "ct_tag_id" ], "unique": true }, + { + "name": "ct_tag_id_id", + "comment": "Covering index, so we can pull all the info only out of the index.", + "columns": [ "ct_tag_id", "ct_rc_id", "ct_rev_id", "ct_log_id" ], + "unique": false + } + ], + "pk": [ "ct_id" ] + }, + { + "name": "content", + "comment": "The content table represents content objects. It's primary purpose is to provide the necessary meta-data for loading and interpreting a serialized data blob to create a content object.", + "columns": [ + { + "name": "content_id", + "comment": "ID of the content object", + "type": "bigint", + "options": { "notnull": true, "unsigned": true, "autoincrement": true } + }, + { + "name": "content_size", + "comment": "Nominal size of the content object (not necessarily of the serialized blob)", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "content_sha1", + "comment": "Nominal hash of the content object (not necessarily of the serialized blob)", + "type": "binary", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "content_model", + "comment": "reference to model_id. Note the content format isn't specified; it should be assumed to be in the default format for the model unless auto-detected otherwise.", + "type": "smallint", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "content_address", + "comment": "URL-like address of the content blob", + "type": "binary", + "options": { "notnull": true, "length": 255 } + } + ], + "indexes": [], + "pk": [ "content_id" ] + }, + { + "name": "l10n_cache", + "comment": "Table for storing localisation data", + "columns": [ + { + "name": "lc_lang", + "comment": "Language code", + "type": "binary", + "options": { "notnull": true, "length": 35 } + }, + { + "name": "lc_key", + "comment": "Cache key", + "type": "string", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "lc_value", + "comment": "Value", + "type": "blob", + "options": { "notnull": true, "length": 16777215 } + } + ], + "indexes": [], + "pk": [ "lc_lang", "lc_key" ] + }, + { + "name": "module_deps", + "comment": "Table caching which local files a module depends on that aren't registered directly, used for fast retrieval of file dependency. Currently only used for tracking images that CSS depends on", + "columns": [ + { + "name": "md_module", + "comment": "Module name", + "type": "binary", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "md_skin", + "comment": "Module context vary (includes skin and language; called \"md_skin\" for legacy reasons)", + "type": "binary", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "md_deps", + "comment": "JSON blob with file dependencies", + "type": "blob", + "options": { "notnull": true, "length": 16777215 } + } + ], + "indexes": [], + "pk": [ "md_module", "md_skin" ] + }, + { + "name": "redirect", + "comment": "For each redirect, this table contains exactly one row defining its target.\nRedirect targets are key to page_namespace/page_title of the target page.\nThe target page may or may not exist, and due to renames\nand deletions may refer to different page records as time\ngoes by.", + "columns": [ + { + "name": "rd_from", + "comment": "Key to the page_id of the redirect page", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rd_namespace", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "rd_title", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "rd_interwiki", + "type": "string", + "options": { "notnull": false, "length": 32, "default": null }, + "comment": "After T346290 all values have been computed and this field is never null. TODO: Mark as not null (T348029)." + }, + { + "name": "rd_fragment", + "type": "binary", + "options": { "notnull": false, "length": 255, "default": null }, + "comment": "After T346290 all values have been computed and this field is never null. TODO: Mark as not null (T348029)." + } + ], + "indexes": [ + { "name": "rd_ns_title", "columns": [ "rd_namespace", "rd_title", "rd_from" ], "unique": false } + ], + "pk": [ "rd_from" ] + }, + { + "name": "pagelinks", + "comment": "Track page-to-page hyperlinks within the wiki. The target page may or may not exist, and due to renames and deletions may refer to different page records as time goes by.", + "columns": [ + { + "name": "pl_from", + "comment": "Key to the page_id of the page containing the link.", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "pl_from_namespace", + "type": "integer", + "comment": "Namespace for pl_from page", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "pl_target_id", + "type": "bigint", + "comment": "Foreign key to linktarget.lt_id", + "options": { "notnull": false, "unsigned": true } + } + ], + "indexes": [ + { + "name": "pl_target_id", + "columns": [ "pl_target_id", "pl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "pl_backlinks_namespace_target_id", + "columns": [ "pl_from_namespace", "pl_target_id", "pl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + } + ], + "pk": [ "pl_from", "pl_target_id" ] + }, + { + "name": "templatelinks", + "comment": "Track template inclusions. The target page may or may not exist, and due to renames and deletions may refer to different page records as time goes by.", + "columns": [ + { + "name": "tl_from", + "comment": "Key to the page_id of the page containing the link.", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "tl_from_namespace", + "type": "integer", + "comment": "Namespace for this page", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "tl_target_id", + "type": "bigint", + "comment": "Foreign key to linktarget.lt_id", + "options": { "notnull": true, "unsigned": true } + } + ], + "indexes": [ + { + "name": "tl_target_id", + "columns": [ "tl_target_id", "tl_from" ], + "comment": "Reverse index, for Special:Whatlinkshere", + "unique": false + }, + { + "name": "tl_backlinks_namespace_target_id", + "columns": [ "tl_from_namespace", "tl_target_id", "tl_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + } + ], + "pk": [ "tl_from", "tl_target_id" ] + }, + { + "name": "imagelinks", + "comment": "Track links to images *used inline* We don't distinguish live from broken links here, so they do not need to be changed on upload/removal.", + "columns": [ + { + "name": "il_from", + "comment": "Key to page_id of the page containing the image / media link.", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "il_from_namespace", + "type": "integer", + "comment": "Namespace for this page", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "il_to", + "type": "binary", + "comment": "Filename of target image. This is also the page_title of the file's description page; all such pages are in namespace 6 (NS_FILE).", + "options": { "notnull": true, "length": 255, "default": "" } + } + ], + "indexes": [ + { + "name": "il_to", + "columns": [ "il_to", "il_from" ], + "comment": "Reverse index, for Special:Whatlinkshere and file description page local usage", + "unique": false + }, + { + "name": "il_backlinks_namespace", + "columns": [ "il_from_namespace", "il_to", "il_from" ], + "comment": "Index for Special:Whatlinkshere with namespace filter", + "unique": false + } + ], + "pk": [ "il_from", "il_to" ] + }, + { + "name": "langlinks", + "comment": "Track interlanguage links.", + "columns": [ + { + "name": "ll_from", + "comment": "page_id of the referring page", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "ll_lang", + "type": "binary", + "comment": "Language code of the target", + "options": { "notnull": true, "length": 35, "default": "" } + }, + { + "name": "ll_title", + "type": "binary", + "comment": "Title of the target, including namespace", + "options": { "notnull": true, "length": 255, "default": "" } + } + ], + "indexes": [ + { + "name": "ll_lang", + "columns": [ "ll_lang", "ll_title" ], + "comment": "Index for ApiQueryLangbacklinks", + "unique": false + } + ], + "pk": [ "ll_from", "ll_lang" ] + }, + { + "name": "iwlinks", + "comment": "Track inline interwiki links", + "columns": [ + { + "name": "iwl_from", + "comment": "page_id of the referring page", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "iwl_prefix", + "type": "binary", + "comment": "Interwiki prefix code of the target", + "options": { "notnull": true, "length": 32, "default": "" } + }, + { + "name": "iwl_title", + "type": "binary", + "comment": "Title of the target, including namespace", + "options": { "notnull": true, "length": 255, "default": "" } + } + ], + "indexes": [ + { + "name": "iwl_prefix_title_from", + "columns": [ "iwl_prefix", "iwl_title", "iwl_from" ], + "comment": "Index for ApiQueryIWBacklinks", + "unique": false + } + ], + "pk": [ "iwl_from", "iwl_prefix", "iwl_title" ] + }, + { + "name": "category", + "comment": "Track all existing categories. Something is a category if 1) it has an entry somewhere in categorylinks, or 2) it has a description page. Categories might not have corresponding pages, so they need to be tracked separately. The numbers of member pages (including categories and media), subcategories, and Image: namespace members, respectively are included in this table too. These are signed to make underflow more obvious. We make the first number include the second two for better sorting: subtracting for display is easy, adding for ordering is not.", + "columns": [ + { + "name": "cat_id", + "comment": "Primary key", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "autoincrement": true } + }, + { + "name": "cat_title", + "type": "binary", + "comment": "Name of the category, in the same form as page_title (with underscores). If there is a category page corresponding to this category, by definition, it has this name (in the Category namespace).", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "cat_pages", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "cat_subcats", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "cat_files", + "type": "integer", + "options": { "notnull": true, "default": 0 } + } + ], + "indexes": [ + { + "name": "cat_title", + "columns": [ "cat_title" ], + "unique": true + }, + { + "name": "cat_pages", + "columns": [ "cat_pages" ], + "comment": "For Special:Mostlinkedcategories", + "unique": false + } + ], + "pk": [ "cat_id" ] + }, + { + "name": "watchlist_expiry", + "comment": "Allows setting an expiry for watchlist items.", + "columns": [ + { + "name": "we_item", + "comment": "Key to watchlist.wl_id", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "we_expiry", + "type": "mwtimestamp", + "comment": "Expiry time", + "options": { "notnull": true } + } + ], + "indexes": [ + { + "name": "we_expiry", + "columns": [ "we_expiry" ], + "unique": false + } + ], + "pk": [ "we_item" ] + }, + { + "name": "change_tag_def", + "comment": "Table defining tag names for IDs. Also stores hit counts to avoid expensive queries on change_tag", + "columns": [ + { + "name": "ctd_id", + "comment": "Numerical ID of the tag (ct_tag_id refers to this)", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "ctd_name", + "comment": "Symbolic name of the tag (what would previously be put in ct_tag)", + "type": "binary", + "options": { "length": 255, "notnull": true } + }, + { + "name": "ctd_user_defined", + "comment": "Whether this tag was defined manually by a privileged user using Special:Tags", + "type": "mwtinyint", + "options": { "notnull": true, "length": 1 } + }, + { + "name": "ctd_count", + "comment": "Number of times this tag was used", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "default": 0 } + } + ], + "indexes": [ + { "name": "ctd_name", "columns": [ "ctd_name" ], "unique": true }, + { "name": "ctd_count", "columns": [ "ctd_count" ], "unique": false }, + { "name": "ctd_user_defined", "columns": [ "ctd_user_defined" ], "unique": false } + ], + "pk": [ "ctd_id" ] + }, + { + "name": "ipblocks_restrictions", + "comment": "Partial Block Restrictions", + "columns": [ + { + "name": "ir_ipb_id", + "comment": "The bl_id from block", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "ir_type", + "comment": "The restriction type id.", + "type": "mwtinyint", + "options": { "notnull": true, "length": 4 } + }, + { + "name": "ir_value", + "comment": "The restriction id that corresponds to the type: page ID, namespace ID or BlockActionInfo ID.", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + } + ], + "indexes": [ + { + "name": "ir_type_value", + "comment": "Index to query restrictions by the page or namespace.", + "columns": [ "ir_type", "ir_value" ], + "unique": false + } + ], + "pk": [ "ir_ipb_id", "ir_type", "ir_value" ] + }, + { + "name": "querycache", + "comment": "Used for caching expensive grouped queries", + "columns": [ + { + "name": "qc_type", + "comment": "A key name, generally the base name of the special page", + "type": "binary", + "options": { "length": 32, "notnull": true } + }, + { + "name": "qc_value", + "comment": "Some sort of stored value. Sizes, counts...", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "qc_namespace", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "qc_title", + "type": "binary", + "options": { "length": 255, "notnull": true, "default": "" } + } + ], + "indexes": [ + { "name": "qc_type", "columns": [ "qc_type", "qc_value" ], "unique": false } + ], + "pk": [] + }, + { + "name": "querycachetwo", + "comment": "Used for caching expensive grouped queries that need two links (for example double-redirects)", + "columns": [ + { + "name": "qcc_type", + "comment": "A key name, generally the base name of the special page.", + "type": "binary", + "options": { "length": 32, "notnull": true } + }, + { + "name": "qcc_value", + "comment": "Some sort of stored value. Sizes, counts...", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "qcc_namespace", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "qcc_title", + "type": "binary", + "options": { "length": 255, "notnull": true, "default": "" } + }, + { + "name": "qcc_namespacetwo", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "qcc_titletwo", + "type": "binary", + "options": { "length": 255, "notnull": true, "default": "" } + } + ], + "indexes": [ + { "name": "qcc_type", "columns": [ "qcc_type", "qcc_value" ], "unique": false }, + { "name": "qcc_title", "columns": [ "qcc_type", "qcc_namespace", "qcc_title" ], "unique": false }, + { "name": "qcc_titletwo", "columns": [ "qcc_type", "qcc_namespacetwo", "qcc_titletwo" ], "unique": false } + ], + "pk": [] + }, + { + "name": "page_restrictions", + "comment": "Used for storing page restrictions (i.e. protection levels)", + "columns": [ + { + "name": "pr_id", + "comment": "Field for an ID for this restrictions row (sort-key for Special:ProtectedPages)", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "pr_page", + "comment": "Page to apply restrictions to (Foreign Key to page).", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "pr_type", + "comment": "The protection type (edit, move, etc)", + "type": "binary", + "options": { "length": 60, "notnull": true } + }, + { + "name": "pr_level", + "comment": "The protection level (Sysop, autoconfirmed, etc)", + "type": "binary", + "options": { "length": 60, "notnull": true } + }, + { + "name": "pr_cascade", + "type": "mwtinyint", + "options": { "notnull": true } + }, + { + "name": "pr_expiry", + "comment": "Field for time-limited protection.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + } + ], + "indexes": [ + { "name": "pr_pagetype", "columns": [ "pr_page", "pr_type" ], "unique": true }, + { "name": "pr_typelevel", "columns": [ "pr_type", "pr_level" ], "unique": false }, + { "name": "pr_level", "columns": [ "pr_level" ], "unique": false }, + { "name": "pr_cascade", "columns": [ "pr_cascade" ], "unique": false } + ], + "pk": [ "pr_id" ] + }, + { + "name": "user_groups", + "comment": "User permissions have been broken out to a separate table; this allows sites with a shared user table to have different permissions assigned to a user in each project. This table replaces the old user_rights field which used a comma-separated blob.", + "columns": [ + { + "name": "ug_user", + "comment": "Key to user_id", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "ug_group", + "comment": "Group names are short symbolic string keys. The set of group names is open-ended, though in practice only some predefined ones are likely to be used. At runtime $wgGroupPermissions will associate group keys with particular permissions. A user will have the combined permissions of any group they're explicitly in, plus the implicit '*' and 'user' groups.", + "type": "binary", + "options": { "length": 255, "notnull": true, "default": "" } + }, + { + "name": "ug_expiry", + "comment": "Time at which the user group membership will expire. Set to NULL for a non-expiring (infinite) membership.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + } + ], + "indexes": [ + { "name": "ug_group", "columns": [ "ug_group" ], "unique": false }, + { "name": "ug_expiry", "columns": [ "ug_expiry" ], "unique": false } + ], + "pk": [ "ug_user", "ug_group" ] + }, + { + "name": "querycache_info", + "comment": "Details of updates to cached special pages", + "columns": [ + { + "name": "qci_type", + "comment": "Special page name. Corresponds to a qc_type value", + "type": "binary", + "options": { "length": 32, "notnull": true, "default": "" } + }, + { + "name": "qci_timestamp", + "comment": "Timestamp of last update", + "type": "mwtimestamp", + "options": { "notnull": true, "default": "19700101000000" } + } + ], + "indexes": [], + "pk": [ "qci_type" ] + }, + { + "name": "watchlist", + "columns": [ + { + "name": "wl_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "wl_user", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "wl_namespace", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "wl_title", + "type": "binary", + "options": { "length": 255, "notnull": true, "default": "" } + }, + { + "name": "wl_notificationtimestamp", + "comment": "Timestamp used to send notification e-mails and show 'updated since last visit' markers. Set to NULL when the user visits the latest revision of the page, which means that they should be sent an e-mail on the next change.", + "type": "mwtimestamp", + "options": { "notnull": false } + } + ], + "indexes": [ + { + "name": "wl_user", + "columns": [ "wl_user", "wl_namespace", "wl_title" ], + "comment": "Special:Watchlist", + "unique": true + }, + { + "name": "wl_namespace_title", + "columns": [ "wl_namespace", "wl_title" ], + "comment": "Special:Movepage (WatchedItemStore::duplicateEntry)", + "unique": false + }, + { + "name": "wl_user_notificationtimestamp", + "columns": [ "wl_user", "wl_notificationtimestamp" ], + "comment": "ApiQueryWatchlistRaw changed filter", + "unique": false + } + ], + "pk": [ "wl_id" ] + }, + { + "name": "sites", + "comment": "Holds all the sites known to the wiki.", + "columns": [ + { + "name": "site_id", + "type": "integer", + "comment": "Numeric id of the site", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "site_global_key", + "type": "binary", + "comment": "Global identifier for the site, ie 'enwiktionary'", + "options": { "notnull": true, "length": 64 } + }, + { + "name": "site_type", + "type": "binary", + "comment": "Type of the site, ie 'mediawiki'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_group", + "type": "binary", + "comment": "Group of the site, ie 'wikipedia'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_source", + "type": "binary", + "comment": "Source of the site data, ie 'local', 'wikidata', 'my-magical-repo'", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_language", + "type": "binary", + "comment": "Language code of the sites primary language.", + "options": { "notnull": true, "length": 35 } + }, + { + "name": "site_protocol", + "type": "binary", + "comment": "Protocol of the site, ie 'http://', 'irc://', '//'. This field is an index for lookups and is build from type specific data in site_data.", + "options": { "notnull": true, "length": 32 } + }, + { + "name": "site_domain", + "type": "string", + "comment": "Domain of the site in reverse order, ie 'org.mediawiki.www.'. This field is an index for lookups and is build from type specific data in site_data.", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "site_data", + "type": "blob", + "comment": "Type dependent site data.", + "options": { "notnull": true, "length": 65530 } + }, + { + "name": "site_forward", + "type": "mwtinyint", + "comment": "If site.tld/path/key:pageTitle should forward users to the page on the actual site, where \"key\" is the local identifier.", + "options": { "notnull": true, "length": 1 } + }, + { + "name": "site_config", + "type": "blob", + "comment": "Type dependent site config. For instance if template transclusion should be allowed if it's a MediaWiki.", + "options": { "notnull": true, "length": 65530 } + } + ], + "indexes": [ + { "name": "site_global_key", "columns": [ "site_global_key" ], "unique": true } + ], + "pk": [ "site_id" ] + }, + { + "name": "user_newtalk", + "comment": "Stores notifications of user talk page changes, for the display of the 'you have new messages' box", + "columns": [ + { + "name": "user_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "user_ip", + "comment": "If the user is an anonymous user their IP address is stored here since the user_id of 0 is ambiguous", + "type": "binary", + "options": { "length": 40, "notnull": true, "default": "" } + }, + { + "name": "user_last_timestamp", + "comment": "The highest timestamp of revisions of the talk page viewed by this user", + "type": "mwtimestamp", + "options": { "notnull": false } + } + ], + "indexes": [ + { "name": "un_user_id", "columns": [ "user_id" ], "unique": false }, + { "name": "un_user_ip", "columns": [ "user_ip" ], "unique": false } + ], + "pk": [] + }, + { + "name": "interwiki", + "comment": "Recognized interwiki link prefixes", + "columns": [ + { + "name": "iw_prefix", + "type": "string", + "comment": "The interwiki prefix, (e.g. \"Meatball\", or the language prefix \"de\")", + "options": { "length": 32, "notnull": true } + }, + { + "name": "iw_url", + "type": "blob", + "comment": "The URL of the wiki, with \"$1\" as a placeholder for an article name. Any spaces in the name will be transformed to underscores before insertion.", + "options": { "notnull": true, "length": 65530 } + }, + { + "name": "iw_api", + "type": "blob", + "comment": "The URL of the file api.php", + "options": { "notnull": true, "length": 65530 } + }, + { + "name": "iw_wikiid", + "type": "string", + "comment": "The name of the database (for a connection to be established with LBFactory::getMainLB( 'wikiid' ))", + "options": { "notnull": true, "length": 64 } + }, + { + "name": "iw_local", + "type": "mwtinyint", + "comment": "A boolean value indicating whether the wiki is in this project (used, for example, to detect redirect loops)", + "options": { "notnull": true, "length": 1 } + }, + { + "name": "iw_trans", + "type": "mwtinyint", + "comment": "Boolean value indicating whether interwiki transclusions are allowed.", + "options": { "notnull": true, "default": 0 } + } + ], + "indexes": [], + "pk": [ "iw_prefix" ] + }, + { + "name": "protected_titles", + "comment": "Used for storing nonexistent pages that have been protected", + "columns": [ + { + "name": "pt_namespace", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "pt_title", + "type": "binary", + "options": { "length": 255, "notnull": true } + }, + { + "name": "pt_user", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "pt_reason_id", + "type": "bigint", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "pt_timestamp", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "pt_expiry", + "type": "mwtimestamp", + "options": { + "notnull": true, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + }, + { + "name": "pt_create_perm", + "type": "binary", + "options": { "length": 60, "notnull": true } + } + ], + "indexes": [ { "name": "pt_timestamp", "columns": [ "pt_timestamp" ], "unique": false } ], + "pk": [ "pt_namespace", "pt_title" ] + }, + { + "name": "externallinks", + "comment": "Track links to external URLs", + "columns": [ + { + "name": "el_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "el_from", + "type": "integer", + "comment": "page_id of the referring page", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "el_to_domain_index", + "type": "binary", + "comment": "Indexable domain", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "el_to_path", + "type": "blob", + "comment": "Path to the external link without considering the domain", + "options": { "length": 65530, "notnull": false } + } + ], + "indexes": [ + { "name": "el_from", "columns": [ "el_from" ], "unique": false }, + { "name": "el_to_domain_index_to_path", "columns": [ "el_to_domain_index", "el_to_path" ], "unique": false, "options": { "lengths": [ null, 60 ] } } + ], + "pk": [ "el_id" ] + }, + { + "name": "ip_changes", + "comment": "Every time an edit by a logged out user is saved, a row is created in ip_changes. This stores the IP as a hex representation so that we can more easily find edits within an IP range.", + "columns": [ + { + "name": "ipc_rev_id", + "comment": "Foreign key to the revision table, also serves as the unique primary key", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "ipc_rev_timestamp", + "comment": "The timestamp of the revision", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "ipc_hex", + "comment": "Hex representation of the IP address, as returned by Wikimedia\\IPUtils::toHex() For IPv4 it will resemble: ABCD1234 For IPv6: v6-ABCD1234000000000000000000000000 BETWEEN is then used to identify revisions within a given range", + "type": "binary", + "options": { "length": 35, "notnull": true, "default": "" } + } + ], + "indexes": [ + { "name": "ipc_rev_timestamp", "columns": [ "ipc_rev_timestamp" ], "unique": false }, + { "name": "ipc_hex_time", "columns": [ "ipc_hex", "ipc_rev_timestamp" ], "unique": false } + ], + "pk": [ "ipc_rev_id" ] + }, + { + "name": "page_props", + "comment": "Name/value pairs indexed by page_id", + "columns": [ + { + "name": "pp_page", + "type": "integer", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "pp_propname", + "type": "binary", + "options": { "length": 60, "notnull": true } + }, + { + "name": "pp_value", + "type": "blob", + "options": { "length": 65530, "notnull": true } + }, + { + "name": "pp_sortkey", + "type": "float", + "options": { "notnull": false } + } + ], + "indexes": [ + { "name": "pp_propname_page", "columns": [ "pp_propname", "pp_page" ], "unique": true }, + { "name": "pp_propname_sortkey_page", "columns": [ "pp_propname", "pp_sortkey", "pp_page" ], "unique": true, "options": { "where": "(pp_sortkey IS NOT NULL)" } } + ], + "pk": [ "pp_page", "pp_propname" ] + }, + { + "name": "job", + "comment": "Jobs performed by parallel apache threads or a command-line daemon", + "columns": [ + { + "name": "job_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "job_cmd", + "comment": "Command name. Limited to 60 to prevent key length overflow", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 60 } + }, + { + "name": "job_namespace", + "comment": "Namespace to act on. Should be 0 if the command does not operate on a title", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "job_title", + "comment": "Title to act on. Should be '' if the command does not operate on a title", + "type": "binary", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "job_timestamp", + "comment": "Timestamp of when the job was inserted. NULL for jobs added before addition of the timestamp", + "type": "mwtimestamp", + "options": { "notnull": false } + }, + { + "name": "job_params", + "comment": "Any other parameters to the command. Stored as a PHP serialized array, or an empty string if there are no parameters", + "type": "blob", + "options": { "notnull": true, "length": 16777215 } + }, + { + "name": "job_random", + "comment": "Random, non-unique, number used for job acquisition (for lock concurrency)", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "job_attempts", + "comment": "The number of times this job has been locked", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "job_token", + "comment": "Field that conveys process locks on rows via process UUIDs", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32 } + }, + { + "name": "job_token_timestamp", + "comment": "Timestamp when the job was locked", + "type": "mwtimestamp", + "options": { "notnull": false } + }, + { + "name": "job_sha1", + "comment": "Base 36 SHA1 of the job parameters relevant to detecting duplicates", + "type": "binary", + "options": { "notnull": true, "length": 32, "default": "" } + } + ], + "indexes": [ + { "name": "job_sha1", "columns": [ "job_sha1" ], "unique": false }, + { "name": "job_cmd_token", "columns": [ "job_cmd", "job_token", "job_random" ], "unique": false }, + { "name": "job_cmd_token_id", "columns": [ "job_cmd", "job_token", "job_id" ], "unique": false }, + { "name": "job_cmd", "columns": [ "job_cmd", "job_namespace", "job_title", "job_params" ], + "unique": false, + "options": { "lengths": [ null, null, null, 128 ] } + }, + { "name": "job_timestamp", "columns": [ "job_timestamp" ], "unique": false } + ], + "pk": [ "job_id" ] + }, + { + "name": "slot_roles", + "comment": "Normalization table for role names", + "columns": [ + { + "name": "role_id", + "type": "integer", + "options": { "notnull": true, "autoincrement": true } + }, + { + "name": "role_name", + "type": "binary", + "options": { "notnull": true, "length": 64 } + } + ], + "indexes": [ + { + "name": "role_name", + "columns": [ "role_name" ], + "comment": "Index for looking up the internal ID of a role", + "unique": true + } + ], + "pk": [ "role_id" ] + }, + { + "name": "content_models", + "comment": "Normalization table for content model names", + "columns": [ + { + "name": "model_id", + "type": "integer", + "options": { "notnull": true, "autoincrement": true } + }, + { + "name": "model_name", + "type": "binary", + "options": { "notnull": true, "length": 64 } + } + ], + "indexes": [ + { + "name": "model_name", + "columns": [ "model_name" ], + "comment": "Index for looking up the internal ID of a model", + "unique": true + } + ], + "pk": [ "model_id" ] + }, + { + "name": "categorylinks", + "comment": "Track category inclusions *used inline* This tracks a single level of category membership", + "columns": [ + { + "name": "cl_from", + "comment": "Key to page_id of the page defined as a category member.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "cl_to", + "comment": "Name of the category. This is also the page_title of the category's description page; all such pages are in namespace 14 (NS_CATEGORY).", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 255 } + }, + { + "name": "cl_sortkey", + "comment": "A binary string obtained by applying a sortkey generation algorithm (Collation::getSortKey()) to page_title, or cl_sortkey_prefix . \"\\n\" page_title if cl_sortkey_prefix is nonempty.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 230 } + }, + { + "name": "cl_sortkey_prefix", + "comment": "A prefix for the raw sortkey manually specified by the user, either via [[Category:Foo|prefix]] or {{defaultsort:prefix}}. If nonempty, it's concatenated with a line break followed by the page title before the sortkey conversion algorithm is run. We store this so that we can update collations without reparsing all pages. Note: If you change the length of this field, you also need to change code in LinksUpdate.php. See T27254.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 255 } + }, + { + "name": "cl_timestamp", + "comment": "This isn't really used at present. Provided for an optional sorting method by approximate addition time.", + "type": "datetimetz", + "options": { "notnull": true, "PlatformOptions": { "version": true } } + }, + { + "name": "cl_collation", + "comment": "Stores $wgCategoryCollation at the time cl_sortkey was generated. This can be used to install new collation versions, tracking which rows are not yet updated. '' means no collation, this is a legacy row that needs to be updated by updateCollation.php. In the future, it might be possible to specify different collations per category.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32 } + }, + { + "name": "cl_type", + "comment": "Stores whether cl_from is a category, file, or other page, so we can paginate the three categories separately. This only has to be updated when moving pages into or out of the category namespace, since file pages cannot be moved to other namespaces, nor can non-files be moved into the file namespace.", + "type": "mwenum", + "options": { "notnull": true, "default": "page", + "CustomSchemaOptions": { + "enum_values": [ "page", "subcat", "file" ] + } + } + } + ], + "indexes": [ + { + "name": "cl_sortkey", + "comment": "We always sort within a given category, and within a given type. FIXME: Formerly this index didn't cover cl_type (since that didn't exist), so old callers won't be using an index: fix this?", + "columns": [ "cl_to", "cl_type", "cl_sortkey", "cl_from" ], + "unique": false + }, + { + "name": "cl_timestamp", + "comment": "Used by the API (and some extensions)", + "columns": [ "cl_to", "cl_timestamp" ], + "unique": false + } + ], + "pk": [ "cl_from", "cl_to" ] + }, + { + "name": "logging", + "columns": [ + { + "name": "log_id", + "comment": "Log ID, for referring to this specific log entry, probably for deletion and such.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "log_type", + "comment": "Symbolic key for the general log type. The output format will be controlled by the log_action field.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32 } + }, + { + "name": "log_action", + "comment": "Symbolic key for the log action type.", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32 } + }, + { + "name": "log_timestamp", + "type": "mwtimestamp", + "options": { "notnull": true, "default": "19700101000000" } + }, + { + "name": "log_actor", + "type": "bigint", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "log_namespace", + "comment": "Key to the namespace of the page affected", + "type": "integer", + "options": { "notnull": true, "default": 0 } + }, + { + "name": "log_title", + "comment": "Key to the title of the page affected", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 255 } + }, + { + "name": "log_page", + "comment": "Key to the page affected", + "type": "integer", + "options": { "notnull": false, "unsigned": true } + }, + { + "name": "log_comment_id", + "comment": "Key to comment_id. Comment summarizing the change.", + "type": "bigint", + "options": { "notnull": true, "unsigned": true } + }, + { + "name": "log_params", + "comment": "LF separated list (old system) or serialized PHP array (new system)", + "type": "blob", + "options": { "notnull": true, "length": 65530 } + }, + { + "name": "log_deleted", + "comment": "rev_deleted for logs", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + } + ], + "indexes": [ + { + "name": "log_type_time", + "comment": "Special:Log type filter", + "columns": [ "log_type", "log_timestamp" ], + "unique": false + }, + { + "name": "log_actor_time", + "comment": "Special:Log performer filter", + "columns": [ "log_actor", "log_timestamp" ], + "unique": false + }, + { + "name": "log_page_time", + "comment": "Special:Log title filter, log extract", + "columns": [ "log_namespace", "log_title", "log_timestamp" ], + "unique": false + }, + { + "name": "log_times", + "comment": "Special:Log unfiltered", + "columns": [ "log_timestamp" ], + "unique": false + }, + { + "name": "log_actor_type_time", + "comment": "Special:Log filter by performer and type", + "columns": [ "log_actor", "log_type", "log_timestamp" ], + "unique": false + }, + { + "name": "log_page_id_time", + "comment": "Apparently just used for a few maintenance pages (findMissingFiles.php, Flow). Could be removed?", + "columns": [ "log_page", "log_timestamp" ], + "unique": false + }, + { + "name": "log_type_action", + "comment": "Special:Log action filter", + "columns": [ "log_type", "log_action", "log_timestamp" ], + "unique": false + } + ], + "pk": [ "log_id" ] + }, + { + "name": "uploadstash", + "comment": "Store information about newly uploaded files before they're moved into the actual filestore", + "columns": [ + { + "name": "us_id", + "type": "integer", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "us_user", + "comment": "the user who uploaded the file.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "us_key", + "comment": "file key. this is how applications actually search for the file. this might go away, or become the primary key.", + "type": "string", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "us_orig_path", + "comment": "the original path", + "type": "string", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "us_path", + "comment": "the temporary path at which the file is actually stored", + "type": "string", + "options": { + "notnull": true, + "length": 255 + } + }, + { + "name": "us_source_type", + "comment": "which type of upload the file came from (sometimes)", + "type": "string", + "options": { + "notnull": false, + "length": 50 + } + }, + { + "name": "us_timestamp", + "comment": "the date/time on which the file was added", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "us_status", + "type": "string", + "options": { + "notnull": true, + "length": 50 + } + }, + { + "name": "us_chunk_inx", + "comment": "chunk counter starts at 0, current offset is stored in us_size", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false + } + }, + { + "name": "us_props", + "comment": "Serialized file properties from FSFile::getProps()", + "type": "blob", + "options": { + "notnull": false, + "length": 65530 + } + }, + { + "name": "us_size", + "comment": "file size in bytes", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "us_sha1", + "comment": "this hash comes from FSFile::getSha1Base36(), and is 31 characters", + "type": "string", + "options": { + "notnull": true, + "length": 31 + } + }, + { + "name": "us_mime", + "type": "string", + "options": { + "notnull": false, + "length": 255 + } + }, + { + "name": "us_media_type", + "comment": "Media type as defined by the MEDIATYPE_xxx constants, should duplicate definition in the image table", + "type": "mwenum", + "options": { "notnull": false, "default": null, + "fixed": true, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "us_image_width", + "comment": "image-specific properties", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false + } + }, + { + "name": "us_image_height", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false + } + }, + { + "name": "us_image_bits", + "type": "smallint", + "options": { + "unsigned": true, + "notnull": false + } + } + ], + "indexes": [ + { + "name": "us_user", + "comment": "sometimes there's a delete for all of a user's stuff.", + "columns": [ + "us_user" + ], + "unique": false + }, + { + "name": "us_key", + "comment": "pick out files by key, enforce key uniqueness", + "columns": [ + "us_key" + ], + "unique": true + }, + { + "name": "us_timestamp", + "comment": "the abandoned upload cleanup script needs this", + "columns": [ + "us_timestamp" + ], + "unique": false + } + ], + "pk": [ + "us_id" + ] + }, + { + "name": "filearchive", + "comment": "Record of deleted file data", + "columns": [ + { + "name": "fa_id", + "comment": "Unique row id", + "type": "integer", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_name", + "comment": "Original base filename; key to image.img_name, page.page_title, etc", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "fa_archive_name", + "comment": "Filename of archived file, if an old revision", + "type": "binary", + "options": { + "notnull": false, + "default": "", + "length": 255 + } + }, + { + "name": "fa_storage_group", + "comment": "Which storage bin (directory tree or object store) the file data is stored in. Should be 'deleted' for files that have been deleted; any other bin is not yet in use.", + "type": "binary", + "options": { + "notnull": false, + "length": 16 + } + }, + { + "name": "fa_storage_key", + "comment": "SHA-1 of the file contents plus extension, used as a key for storage. eg 8f8a562add37052a1848ff7771a2c515db94baa9.jpg. If NULL, the file was missing at deletion time or has been purged from the archival storage.", + "type": "binary", + "options": { + "notnull": false, + "default": "", + "length": 64 + } + }, + { + "name": "fa_deleted_user", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "fa_deleted_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": false + } + }, + { + "name": "fa_deleted_reason_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_size", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_width", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_height", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_metadata", + "type": "blob", + "options": { + "notnull": false, + "length": 16777215 + } + }, + { + "name": "fa_bits", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_media_type", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "fa_major_mime", + "type": "mwenum", + "options": { + "notnull": false, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "fa_minor_mime", + "type": "binary", + "options": { + "notnull": false, + "default": "unknown", + "length": 100 + } + }, + { + "name": "fa_description_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_actor", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": false + } + }, + { + "name": "fa_deleted", + "comment": "Visibility of deleted revisions, bitfield", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "fa_sha1", + "comment": "sha1 hash of file content", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "fa_name", + "comment": "pick out by image name", + "columns": [ + "fa_name", + "fa_timestamp" + ], + "unique": false + }, + { + "name": "fa_storage_group", + "comment": "pick out dupe files", + "columns": [ + "fa_storage_group", + "fa_storage_key" + ], + "unique": false + }, + { + "name": "fa_deleted_timestamp", + "comment": "sort by deletion time", + "columns": [ + "fa_deleted_timestamp" + ], + "unique": false + }, + { + "name": "fa_actor_timestamp", + "comment": "sort by uploader", + "columns": [ + "fa_actor", + "fa_timestamp" + ], + "unique": false + }, + { + "name": "fa_sha1", + "comment": "find file by sha1, 10 bytes will be enough for hashes to be indexed", + "columns": [ + "fa_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + } + ], + "pk": [ + "fa_id" + ] + }, + { + "name": "text", + "comment": "Holds text of individual page revisions. Field names are a holdover from the 'old' revisions table in MediaWiki 1.4 and earlier: an upgrade will transform that table into the 'text' table to minimize unnecessary churning and downtime. If upgrading, the other fields will be left unused. This table can also hold metadata of files if the metadata is too big to store in img_metadata, oi_metadata or fa_metadata.", + "columns": [ + { + "name": "old_id", + "comment": "Unique text storage key number. Note that the 'oldid' parameter used in URLs does *not* refer to this number anymore, but to rev_id. content.content_address refers to this column. Also img_metadata, oi_metadata or fa_metadata can refer to this column when being used to store file metadata.", + "type": "integer", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "old_text", + "comment": "Depending on the contents of the old_flags field, the text may be convenient plain text, or it may be funkily encoded.", + "type": "blob", + "options": { + "notnull": true, + "length": 16777215 + } + }, + { + "name": "old_flags", + "comment": "Comma-separated list of flags:\n* gzip: text is compressed with PHP's gzdeflate() function.\n* utf-8: text was stored as UTF-8. If $wgLegacyEncoding option is on, rows *without* this flag will be converted to UTF-8 transparently at load time. Note that due to a bug in a maintenance script, this flag may have been stored as 'utf8' in some cases (T18841).\n* object: text field contained a serialized PHP object. The object either contains multiple versions compressed together to achieve a better compression ratio, or it refers to another row where the text can be found.\n* external: text was stored in an external location specified by old_text. Any additional flags apply to the data stored at that URL, not the URL itself. The 'object' flag is *not* set for URLs of the form 'DB://cluster/id/itemid', because the external storage system itself decompresses these.", + "type": "blob", + "options": { + "notnull": true, + "length": 255 + } + } + ], + "indexes": [], + "pk": [ + "old_id" + ] + }, + { + "name": "oldimage", + "comment": "Previous revisions of uploaded files. Awkwardly, image rows have to be moved into this table at re-upload time.", + "columns": [ + { + "name": "oi_name", + "comment": "Base filename: key to image.img_name", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "oi_archive_name", + "comment": "Filename of the archived file. This is generally a timestamp and '!' prepended to the base name.", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "oi_size", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_width", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_height", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_bits", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_description_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "oi_actor", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "oi_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "oi_metadata", + "type": "blob", + "options": { + "notnull": true, + "length": 16777215 + } + }, + { + "name": "oi_media_type", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "oi_major_mime", + "type": "mwenum", + "options": { + "notnull": true, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "oi_minor_mime", + "type": "binary", + "options": { + "notnull": true, + "default": "unknown", + "length": 100 + } + }, + { + "name": "oi_deleted", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "oi_sha1", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "oi_actor_timestamp", + "columns": [ + "oi_actor", + "oi_timestamp" + ], + "unique": false + }, + { + "name": "oi_name_timestamp", + "columns": [ + "oi_name", + "oi_timestamp" + ], + "unique": false + }, + { + "name": "oi_name_archive_name", + "comment": "oi_archive_name truncated to 14 to avoid key length overflow", + "columns": [ + "oi_name", + "oi_archive_name" + ], + "unique": false, + "options": { "lengths": [ null, 14 ] } + }, + { + "name": "oi_sha1", + "columns": [ + "oi_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + }, + { + "name": "oi_timestamp", + "comment": "Used by Special:ListFiles", + "columns": [ + "oi_timestamp" + ], + "unique": false + } + ] + }, + { + "name": "objectcache", + "comment": "For a few generic cache operations if not using Memcached", + "columns": [ + { + "name": "keyname", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 255 } + }, + { + "name": "value", + "type": "blob", + "options": { "notnull": false, "length": 16777215 } + }, + { + "name": "exptime", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "modtoken", + "type": "string", + "options": { "notnull": true, "length": 17, "default": "00000000000000000" } + }, + { + "name": "flags", + "type": "integer", + "options": { "notnull": false, "unsigned": true, "default": null } + } + ], + "indexes": [ + { "name": "exptime", "columns": [ "exptime" ], "unique": false } + ], + "pk": [ "keyname" ] + }, + { + "name": "block", + "comment": "Blocks against user accounts, IP addresses and IP ranges.", + "columns": [ + { + "name": "bl_id", + "comment": "Primary key.", + "type": "integer", + "options": { + "autoincrement": true, + "notnull": true, + "unsigned": true + } + }, + { + "name": "bl_target", + "comment": "The block target. Foreign key to block_target.bt_id.", + "type": "integer", + "options": { + "notnull": true, + "unsigned": true + } + }, + { + "name": "bl_by_actor", + "comment": "Actor who made the block.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "bl_reason_id", + "comment": "Key to comment_id. Text comment made by blocker.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "bl_timestamp", + "comment": "Creation (or refresh) date in standard YMDHMS form. IP blocks expire automatically.", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "bl_anon_only", + "comment": "If set to 1, block applies only to logged-out users and temporary users.", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "bl_create_account", + "comment": "Block prevents account creation from matching IP addresses", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 1 + } + }, + { + "name": "bl_enable_autoblock", + "comment": "Block triggers autoblocks", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 1 + } + }, + { + "name": "bl_expiry", + "comment": "Time at which the block will expire. May be \"infinity\"", + "type": "mwtimestamp", + "options": { + "notnull": true, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + }, + { + "name": "bl_deleted", + "comment": "If true, this block causes the username to be hidden, and the expiry must be infinite. This is denormalized into rev_deleted and the other deleted bitfields (T346716).", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "bl_block_email", + "comment": "Block prevents user from accessing Special:Emailuser", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "bl_allow_usertalk", + "comment": "Block allows user to edit their own talk page", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "bl_parent_block_id", + "comment": "ID of the block that caused this block to exist. Autoblocks set this to the original block so that the original block being deleted also deletes the autoblocks.", + "type": "integer", + "options": { + "notnull": false, + "unsigned": true, + "default": null + } + }, + { + "name": "bl_sitewide", + "comment": "Block user from editing any page on the site (other than their own user talk page).", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 1 + } + } + ], + "indexes": [ + { + "name": "bl_timestamp", + "comment": "Index for Special:BlockList", + "columns": [ + "bl_timestamp" + ], + "unique": false + }, + { + "name": "bl_target", + "comment": "For searching by target", + "columns": [ "bl_target" ], + "unique": false + }, + { + "name": "bl_expiry", + "comment": "Index for table pruning", + "columns": [ + "bl_expiry" + ], + "unique": false + }, + { + "name": "bl_parent_block_id", + "comment": "Index for removing autoblocks when a parent block is removed", + "columns": [ + "bl_parent_block_id" + ], + "unique": false + } + ], + "pk": [ + "bl_id" + ] + }, + { + "name": "block_target", + "comment": "The targets of blocks", + "columns": [ + { + "name": "bt_id", + "comment": "Primary key.", + "type": "integer", + "options": { + "autoincrement": true, + "notnull": true, + "unsigned": true + } + }, + { + "name": "bt_address", + "comment": "Blocked IP address or range in dotted-quad form, or null for a user block. If bt_auto is 1 then the address is private.", + "type": "blob", + "options": { + "notnull": false, + "length": 255 + } + }, + { + "name": "bt_user", + "comment": "Blocked user ID or null for IP blocks.", + "type": "integer", + "options": { + "notnull": false, + "unsigned": true + } + }, + { + "name": "bt_user_text", + "comment": "The name of the blocked user, or null for IP blocks. For Special:BlockList sorting (T48013).", + "type": "binary", + "options": { + "notnull": false, + "length": 255 + } + }, + { + "name": "bt_auto", + "comment": "Indicates that the IP address was banned because a banned user accessed a page through it. If this is 1, ipb_address will be hidden, and the block identified by block ID number.", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + }, + { + "name": "bt_range_start", + "comment": "Start of an address range, in hexadecimal. Null for single-IP and user blocks.", + "type": "blob", + "options": { + "notnull": false, + "length": 255 + } + }, + { + "name": "bt_range_end", + "comment": "End of an address range, in hexadecimal. Null for single-IP and user blocks.", + "type": "blob", + "options": { + "notnull": false, + "length": 255 + } + }, + { + "name": "bt_ip_hex", + "comment": "If the block is for a single IP, this is the IP address in hexadecimal. If the block is for a range, the start of the range in hexadecimal, identical to bt_range_start.", + "type": "blob", + "options": { + "notnull": false, + "length": 255 + } + }, + { + "name": "bt_count", + "comment": "The number of block rows associated with this target.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + } + ], + "indexes": [ + { + "name": "bt_address", + "comment": "For finding single IP blocks and for Special:BlockList searching.", + "columns": [ "bt_address" ], + "options": { "lengths": [ 42 ] }, + "unique": false + }, + { + "name": "bt_ip_user_text", + "comment": "For sorting Special:BlockList by target (T48013)", + "columns": [ "bt_ip_hex", "bt_user_text" ], + "options": { "lengths": [ 35, 255 ] }, + "unique": false + }, + { + "name": "bt_range", + "comment": "For querying whether an IP address is in any range", + "columns": [ + "bt_range_start", + "bt_range_end" + ], + "options": { "lengths": [ 35, 35 ] }, + "unique": false + }, + { + "name": "bt_user", + "comment": "For querying whether a logged-in user is blocked", + "columns": [ "bt_user" ], + "unique": false + } + ], + "pk": [ + "bt_id" + ] + }, + { + "name": "image", + "comment": "Uploaded images and other files.", + "columns": [ + { + "name": "img_name", + "comment": "Filename. This is also the title of the associated description page, which will be in namespace 6 (NS_FILE).", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "img_size", + "comment": "File size in bytes.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "img_width", + "comment": "For images, width in pixels.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "img_height", + "comment": "For images, height in pixels.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "img_metadata", + "comment": "Extracted Exif metadata stored as a json array (new system) or serialized PHP array (old system). The json array can contain an address in the text table or external storage.", + "type": "blob", + "options": { + "notnull": true, + "length": 16777215 + } + }, + { + "name": "img_bits", + "comment": "For images, bits per pixel if known.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "img_media_type", + "comment": "Media type as defined by the MEDIATYPE_xxx constants", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "img_major_mime", + "comment": "major part of a MIME media type as defined by IANA see https://www.iana.org/assignments/media-types/ for \"chemical\" cf. http://dx.doi.org/10.1021/ci9803233 by the ACS", + "type": "mwenum", + "options": { + "notnull": true, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "img_minor_mime", + "comment": "minor part of a MIME media type as defined by IANA the minor parts are not required to adhere to any standard but should be consistent throughout the database see https://www.iana.org/assignments/media-types/", + "type": "binary", + "options": { + "notnull": true, + "default": "unknown", + "length": 100 + } + }, + { + "name": "img_description_id", + "comment": "Foreign key to comment table, which contains the description field as entered by the uploader. This is displayed in image upload history and logs.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "img_actor", + "comment": "actor_id of the uploader.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "img_timestamp", + "comment": "Time of the upload.", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "img_sha1", + "comment": "SHA-1 content hash in base-36", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "img_actor_timestamp", + "comment": "Used by Special:Newimages and ApiQueryAllImages", + "columns": [ + "img_actor", + "img_timestamp" + ], + "unique": false + }, + { + "name": "img_size", + "comment": "Used by Special:ListFiles for sort-by-size", + "columns": [ + "img_size" + ], + "unique": false + }, + { + "name": "img_timestamp", + "comment": "Used by Special:Newimages and Special:ListFiles", + "columns": [ + "img_timestamp" + ], + "unique": false + }, + { + "name": "img_sha1", + "comment": "Used in API and duplicate search", + "columns": [ + "img_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + }, + { + "name": "img_media_mime", + "comment": "Used to get media of one type", + "columns": [ + "img_media_type", + "img_major_mime", + "img_minor_mime" + ], + "unique": false + } + ], + "pk": [ + "img_name" + ] + }, + { + "name": "recentchanges", + "comment": "Primarily a summary table for Special:RecentChanges, this table contains some additional info on edits from the last few days", + "columns": [ + { + "name": "rc_id", + "type": "bigint", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "rc_actor", + "comment": "As in revision", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_namespace", + "comment": "When pages are renamed, their RC entries do _not_ change.", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_title", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "rc_comment_id", + "comment": "as in revision...", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "rc_minor", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_bot", + "comment": "Edits by user accounts with the 'bot' rights key are marked with a 1 here, and will be hidden from the default view.", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_new", + "comment": "Set if this change corresponds to a page creation", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_cur_id", + "comment": "Key to page_id (was cur_id prior to 1.5). This will keep links working after moves while retaining the at-the-time name in the changes list.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_this_oldid", + "comment": "rev_id of the given revision", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_last_oldid", + "comment": "rev_id of the prior revision, for generating diff links.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_type", + "comment": "The type of change entry (RC_EDIT,RC_NEW,RC_LOG,RC_EXTERNAL)", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_source", + "comment": "The source of the change entry (replaces rc_type) default of '' is temporary, needed for initial migration", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 16 + } + }, + { + "name": "rc_patrolled", + "comment": "If the Recent Changes Patrol option is enabled, users may mark edits as having been reviewed to remove a warning flag on the RC list. A value of 1 indicates the page has been reviewed.", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_ip", + "comment": "Recorded IP address the edit was made from, if the $wgPutIPinRC option is enabled.", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 40 + } + }, + { + "name": "rc_old_len", + "comment": "Text length in characters before the edit", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "rc_new_len", + "comment": "Text length in characters after the edit", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "rc_deleted", + "comment": "Visibility of recent changes items, bitfield", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_logid", + "comment": "Value corresponding to log_id, specific log entries", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "rc_log_type", + "comment": "Store log type info here, or null", + "type": "binary", + "options": { + "notnull": false, + "default": null, + "length": 255 + } + }, + { + "name": "rc_log_action", + "comment": "Store log action or null", + "type": "binary", + "options": { + "notnull": false, + "default": null, + "length": 255 + } + }, + { + "name": "rc_params", + "comment": "Log params", + "type": "blob", + "options": { + "notnull": false, + "length": 65535 + } + } + ], + "indexes": [ + { + "name": "rc_timestamp", + "comment": "Special:Recentchanges", + "columns": [ + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_namespace_title_timestamp", + "comment": "Special:Watchlist", + "columns": [ + "rc_namespace", + "rc_title", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_cur_id", + "comment": "Special:Recentchangeslinked when finding changes in pages linked from a page", + "columns": [ + "rc_cur_id" + ], + "unique": false + }, + { + "name": "rc_new_name_timestamp", + "comment": "Special:Newpages", + "columns": [ + "rc_new", + "rc_namespace", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_ip", + "comment": "Blank unless $wgPutIPinRC=true (false at WMF), possibly used by extensions, but mostly replaced by CheckUser.", + "columns": [ + "rc_ip" + ], + "unique": false + }, + { + "name": "rc_ns_actor", + "comment": "Probably intended for Special:NewPages namespace filter", + "columns": [ + "rc_namespace", + "rc_actor" + ], + "unique": false + }, + { + "name": "rc_actor", + "comment": "SiteStats active user count, Special:ActiveUsers, Special:NewPages user filter", + "columns": [ + "rc_actor", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_name_type_patrolled_timestamp", + "comment": "ApiQueryRecentChanges (T140108)", + "columns": [ + "rc_namespace", + "rc_type", + "rc_patrolled", + "rc_timestamp" + ], + "unique": false + }, + { + "name": "rc_this_oldid", + "comment": "Article.php and friends (T139012)", + "columns": [ + "rc_this_oldid" + ], + "unique": false + } + ], + "pk": [ + "rc_id" + ] + }, + { + "name": "archive", + "comment": "Archive area for deleted pages and their revisions. These may be viewed (and restored) by admins through the Special:Undelete interface.", + "columns": [ + { + "name": "ar_id", + "comment": "Primary key", + "type": "integer", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "ar_namespace", + "comment": "Copied from page_namespace", + "type": "integer", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "ar_title", + "comment": "Copied from page_title", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "ar_comment_id", + "comment": "Basic revision stuff.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "ar_actor", + "comment": "Basic revision stuff.", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "ar_timestamp", + "comment": "Basic revision stuff.", + "type": "mwtimestamp", + "options": { + "notnull": true + } + }, + { + "name": "ar_minor_edit", + "comment": "Basic revision stuff.", + "type": "mwtinyint", + "options": { + "notnull": true, + "default": 0 + } + }, + { + "name": "ar_rev_id", + "comment": "Copied from rev_id.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "ar_deleted", + "comment": "Copied from rev_deleted. Although this may be raised during deletion. Users with the \"suppressrevision\" right may \"archive\" and \"suppress\" content in a single action. @since 1.10", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "ar_len", + "comment": "Copied from rev_len, length of this revision in bytes. @since 1.10", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false + } + }, + { + "name": "ar_page_id", + "comment": "Copied from page_id. Restoration will attempt to use this as page ID if no current page with the same name exists. Otherwise, the revisions will be restored under the current page. Can be used for manual undeletion by developers if multiple pages by the same name were archived. @since 1.11 Older entries will have NULL.", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false + } + }, + { + "name": "ar_parent_id", + "comment": "Copied from rev_parent_id. @since 1.13", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false, + "default": null + } + }, + { + "name": "ar_sha1", + "comment": "Copied from rev_sha1, SHA-1 text content hash in base-36 @since 1.19", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "ar_name_title_timestamp", + "comment": "Index for Special:Undelete to page through deleted revisions", + "columns": [ + "ar_namespace", + "ar_title", + "ar_timestamp" + ], + "unique": false + }, + { + "name": "ar_actor_timestamp", + "comment": "Index for Special:DeletedContributions", + "columns": [ + "ar_actor", + "ar_timestamp" + ], + "unique": false + }, + { + "name": "ar_revid_uniq", + "comment": "Index for linking archive rows with tables that normally link with revision rows, such as change_tag.", + "columns": [ + "ar_rev_id" + ], + "unique": true + } + ], + "pk": [ + "ar_id" + ] + }, + { + "name": "page", + "comment": "Core of the wiki: each page has an entry here which identifies it by title and contains some essential metadata.", + "columns": [ + { + "name": "page_id", + "comment": "Unique identifier number. The page_id will be preserved across edits and rename operations, but not deletions and recreations.", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "page_namespace", + "comment": "A page name is broken into a namespace and a title. The namespace keys are UI-language-independent constants, defined in includes/Defines.php", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "page_title", + "comment": "The rest of the title, as text. Spaces are transformed into underscores in title storage.", + "type": "binary", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "page_is_redirect", + "comment": "1 indicates the article is a redirect. If so, there is a row in the `redirect` table with rd_from=page_id, which contains the redirect target.", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "page_is_new", + "comment": "1 indicates this is a new entry, with only one edit. Not all pages with one edit are new pages.", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "page_random", + "comment": "Random value between 0 and 1, used for Special:Randompage", + "type": "float", + "options": { + "notnull": true, + "unsigned": true, + "CustomSchemaOptions": { + "doublePrecision": true + } + } + }, + { + "name": "page_touched", + "comment": "This timestamp is updated whenever the page changes in a way requiring it to be re-rendered, invalidating caches. Aside from editing this includes permission changes, creation or deletion of linked pages, and alteration of contained templates.", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "page_links_updated", + "comment": "This timestamp is updated whenever a page is re-parsed and it has all the link tracking tables updated for it. This is useful for de-duplicating expensive backlink update jobs.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "default": null + } + }, + { + "name": "page_latest", + "comment": "Handy key to revision.rev_id of the current revision. This may be 0 during page creation, but that shouldn't happen outside of a transaction... hopefully.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "page_len", + "comment": "Uncompressed length in bytes of the page's current source text.", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "page_content_model", + "comment": "content model, see CONTENT_MODEL_XXX constants", + "type": "binary", + "options": { "length": 32, "notnull": false } + }, + { + "name": "page_lang", + "comment": "Page content language", + "type": "binary", + "options": { "length": 35, "notnull": false } + } + ], + "indexes": [ + { + "name": "page_name_title", + "columns": [ "page_namespace", "page_title" ], + "comment": "The title index. Care must be taken to always specify a namespace when by title, so that the index is used. Even listing all known namespaces with IN() is better than omitting page_namespace from the WHERE clause.", + "unique": true + }, + { + "name": "page_random", + "columns": [ "page_random" ], + "comment": "Index for Special:Random", + "unique": false + }, + { + "name": "page_len", + "columns": [ "page_len" ], + "comment": "Questionable utility, used by ProofreadPage, possibly DynamicPageList. ApiQueryAllPages unconditionally filters on namespace and so hopefully does not use it.", + "unique": false + }, + { + "name": "page_redirect_namespace_len", + "columns": [ "page_is_redirect", "page_namespace", "page_len" ], + "comment": "The index for Special:Shortpages and Special:Longpages. Also SiteStats::articles() in 'comma' counting mode, MessageCache::loadFromDB().", + "unique": false + } + ], + "pk": [ "page_id" ] + }, + { + "name": "user", + "comment": "The user table contains basic account information, authentication keys, etc. Some multi-wiki sites may share a single central user table between separate wikis using the $wgSharedDB setting. Note that even when an external authentication plugin is in use, user table entries still need to be created to store preferences and to key tracking information in the other tables", + "columns": [ + { + "name": "user_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "user_name", + "comment": "Usernames must be unique, must not be in the form of an IP address. They should not allow slashes or case conflicts. Spaces are allowed, and are not converted to underscores like in page titles.", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "user_real_name", + "comment": "Optional 'real name' to be displayed in credit listings", + "type": "binary", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "user_password", + "comment": "Password hashes", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_newpassword", + "comment": "When using 'mail me a new password', a random password is generated and the hash stored here. The previous password is left in place until someone actually logs in with the new password, at which point the hash is moved to user_password and the old password is invalidated.", + "type": "blob", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_newpass_time", + "comment": "Timestamp of the last time when a new password was sent, for throttling and expiring purposes. Emailed passwords will expire $wgNewPasswordExpiry (a week) after being set. If user_newpass_time is NULL (eg. created by mail) it doesn't expire.", + "type": "mwtimestamp", + "options": { "notnull": false } + }, + { + "name": "user_email", + "comment": "User email. Non public info.", + "type": "text", + "options": { "notnull": true, "length": 255 } + }, + { + "name": "user_touched", + "comment": "If the browser sends an If-Modified-Since header, a 304 response is suppressed if the value in this field for the current user is later than the value in the IMS header. That is, this field is an invalidation timestamp for the browser cache of logged-in users. Among other things, it is used to prevent pages generated for a previously logged in user from being displayed after a session expiry followed by a fresh login.", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "user_token", + "comment": "A pseudorandomly generated value that is stored in a cookie when the 'remember password' feature is used (previously, a hash of the password was used, but this was vulnerable to cookie-stealing attacks)", + "type": "binary", + "options": { "notnull": true, "default": "", "length": 32, "fixed": true } + }, + { + "name": "user_email_authenticated", + "comment": "Initially NULL; when a user's e-mail address has been validated by returning with a mailed token, this is set to the current timestamp.", + "type": "mwtimestamp", + "options": { "notnull": false } + }, + { + "name": "user_email_token", + "comment": "Randomly generated token created when the e-mail address is set and a confirmation test mail sent.", + "type": "binary", + "options": { "notnull": false, "length": 32, "fixed": true } + }, + { + "name": "user_email_token_expires", + "comment": "Expiration date for the user_email_token.", + "type": "mwtimestamp", + "options": { "notnull": false } + }, + { + "name": "user_registration", + "comment": "Timestamp of account registration. Accounts predating this schema addition may contain NULL.", + "type": "mwtimestamp", + "options": { "notnull": false } + }, + { + "name": "user_editcount", + "comment": "Count of edits and edit-like actions. Not intended to be an accurate copy of 'COUNT(*) WHERE rev_actor refers to a user's actor_id'. May contain NULL for old accounts if batch-update scripts haven't been run, as well as listing deleted edits and other myriad ways it could be out of sync. Meant primarily for heuristic checks to give an impression of whether the account has been used much.", + "type": "integer", + "options": { "notnull": false, "unsigned": true } + }, + { + "name": "user_password_expires", + "comment": "Expiration date for user password.", + "type": "mwtimestamp", + "options": { + "notnull": false, + "CustomSchemaOptions": { + "allowInfinite": true + } + } + }, + { + "name": "user_is_temp", + "comment": "This exists to allow temporary users to be identified from the database only, by external applications, and is not for use within MediaWiki (see T333223). A boolean value representing whether the user is a temporary user. Zero if any type of user other than a temporary user.", + "type": "mwtinyint", + "options": { + "notnull": true, + "length": 1, + "default": 0 + } + } + ], + "indexes": [ + { "name": "user_name", "columns": [ "user_name" ], "unique": true }, + { "name": "user_email_token", "columns": [ "user_email_token" ], "unique": false }, + { "name": "user_email", "columns": [ "user_email" ], "unique": false, "options": { "lengths": [ 50, null, null ] } } + ], + "pk": [ "user_id" ] + }, + { + "name": "user_autocreate_serial", + "comment": "Table for sequential name generation for auto-created temporary users", + "columns": [ + { + "name": "uas_shard", + "comment": "The segment of ID space, ID mod N, referred to by this row", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "uas_year", + "comment": "The year to which this row belongs, if $wgAutoCreateTempUser['serialProvider']['useYear'] is true.", + "type": "smallint", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "uas_value", + "comment": "The maximum allocated ID value", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + } + ], + "indexes": [], + "pk": [ "uas_shard", "uas_year" ] + }, + { + "name": "revision", + "comment": "Every edit of a page creates also a revision row. This stores metadata about the revision, and a reference to the text storage backend.", + "columns": [ + { + "name": "rev_id", + "comment": "Unique ID to identify each revision", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "rev_page", + "comment": "Key to page_id. This should never be invalid", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "rev_comment_id", + "comment": "Key to comment.comment_id. Comment summarizing the change", + "type": "bigint", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "rev_actor", + "comment": "Key to actor.actor_id of the user or IP who made this edit", + "type": "bigint", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "rev_timestamp", + "comment": "Timestamp of when revision was created", + "type": "mwtimestamp", + "options": { "notnull": true } + }, + { + "name": "rev_minor_edit", + "comment": "Records whether the user marked the 'minor edit' checkbox. Many automated edits are marked as minor", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rev_deleted", + "comment": "Restrictions on who can access this revision", + "type": "mwtinyint", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "rev_len", + "comment": "Length of this revision in bytes", + "type": "integer", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "rev_parent_id", + "comment": "Key to revision.rev_id. This field is used to add support for a tree structure (The Adjacency List Model)", + "type": "bigint", + "options": { "unsigned": true, "notnull": false } + }, + { + "name": "rev_sha1", + "comment": "SHA-1 text content hash in base-36", + "type": "binary", + "options": { "length": 32, "notnull": true, "default": "" } + } + ], + "indexes": [ + { + "name": "rev_timestamp", + "columns": [ "rev_timestamp" ], + "comment": "Used by ApiQueryAllRevisions", + "unique": false + }, + { + "name": "rev_page_timestamp", + "columns": [ "rev_page", "rev_timestamp" ], + "comment": "History index", + "unique": false + }, + { + "name": "rev_actor_timestamp", + "columns": [ "rev_actor", "rev_timestamp", "rev_id" ], + "comment": "User contributions index", + "unique": false + }, + { + "name": "rev_page_actor_timestamp", + "columns": [ "rev_page", "rev_actor", "rev_timestamp" ], + "comment": "Credits index. This is scanned in order to compile credits lists for pages, in ApiQueryContributors. Also for ApiQueryRevisions if rvuser is specified", + "unique": false + } + ], + "pk": [ "rev_id" ] + }, + { + "name": "searchindex", + "comment": "search backend, this is actively used in MySQL but created and not used in Postgres while there are plans to use it in the future (T220450). This table must be MyISAM in MySQL; InnoDB does not support the needed fulltext index.", + "columns": [ + { + "name": "si_page", + "comment": "Key to page_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true } + }, + { + "name": "si_title", + "comment": "Munged version of title", + "type": "text", + "options": { "notnull": true, "length": 16777215 } + }, + { + "name": "si_text", + "comment": "Munged version of body text", + "type": "text", + "options": { "notnull": true, "length": 16777215 } + } + ], + "indexes": [ + { + "name": "si_title", + "columns": [ "si_title" ], + "unique": false, + "flags": [ + "fulltext" + ] + }, + { + "name": "si_text", + "columns": [ "si_text" ], + "unique": false, + "flags": [ + "fulltext" + ] + } + ], + "pk": [ "si_page" ], + "table_options": [ + "ENGINE=MyISAM", + "DEFAULT CHARSET=utf8mb4" + ] + }, + { + "name": "linktarget", + "comment": "Holds immutable records of link targets, used mostly for links tables.", + "columns": [ + { + "name": "lt_id", + "comment": "primary key", + "type": "bigint", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "lt_namespace", + "comment": "Namespace of the link target", + "type": "integer", + "options": { "notnull": true } + }, + { + "name": "lt_title", + "comment": "Text part of link target excluding namespace", + "type": "binary", + "options": { "length": 255, "notnull": true } + } + ], + "indexes": [ + { "name": "lt_namespace_title", "columns": [ "lt_namespace", "lt_title" ], "unique": true } + ], + "pk": [ "lt_id" ] + } +] diff --git a/sql/tables.sql b/sql/tables.sql new file mode 100644 index 000000000000..3d55b2471f5c --- /dev/null +++ b/sql/tables.sql @@ -0,0 +1,3 @@ +-- This page is intentionally left blank (T191231) +-- See tables-generated.sql and tables.json +-- TODO: Remove this file (see also TODO in CreateTablesTask::execute) |