* EditPage::isOouiEnabled() is deprecated and will always return true.
* Parser::getRandomString() (deprecated in 1.26) was removed.
* Parser::uniqPrefix() (deprecated in 1.26) was removed.
-* Parser::extractTagsAndParams() now only accepts three arguments. The fourth,
+* Parser::extractTagsAndParams() now only accepts three arguments. The fourth,
$uniq_prefix was deprecated in 1.26 and has now been removed.
+* (T172514) The following tables have had their UNIQUE indexes turned into proper
+ PRIMARY KEYs for increased maintainability: categorylinks, imagelinks, iwlinks,
+ langlinks, log_search, module_deps, objectcache, pagelinks, query_cache, site_stats,
+ templatelinks, text, transcache, user_former_groups, user_properties.
== Compatibility ==
MediaWiki 1.30 requires PHP 5.5.9 or later. There is experimental support for
$order[] = $this->prefix . '_title' . $sort;
$this->addOption( 'ORDER BY', $order );
- $this->addOption( 'USE INDEX', $this->prefix . '_from' );
+ $this->addOption( 'USE INDEX', [ $this->table => 'PRIMARY' ] );
$this->addOption( 'LIMIT', $params['limit'] + 1 );
$res = $this->select( __METHOD__ );
// 1.30
[ 'modifyField', 'image', 'img_media_type', 'patch-add-3d.sql' ],
[ 'addTable', 'ip_changes', 'patch-ip_changes.sql' ],
+ [ 'renameIndex', 'categorylinks', 'cl_from', 'PRIMARY', false,
+ 'patch-categorylinks-fix-pk.sql' ],
+ [ 'renameIndex', 'templatelinks', 'tl_from', 'PRIMARY', false,
+ 'patch-templatelinks-fix-pk.sql' ],
+ [ 'renameIndex', 'pagelinks', 'pl_from', 'PRIMARY', false, 'patch-pagelinks-fix-pk.sql' ],
+ [ 'renameIndex', 'text', 'old_id', 'PRIMARY', false, 'patch-text-fix-pk.sql' ],
+ [ 'renameIndex', 'imagelinks', 'il_from', 'PRIMARY', false, 'patch-imagelinks-fix-pk.sql' ],
+ [ 'renameIndex', 'iwlinks', 'iwl_from', 'PRIMARY', false, 'patch-iwlinks-fix-pk.sql' ],
+ [ 'renameIndex', 'langlinks', 'll_from', 'PRIMARY', false, 'patch-langlinks-fix-pk.sql' ],
+ [ 'renameIndex', 'log_search', 'ls_field_val', 'PRIMARY', false, 'patch-log_search-fix-pk.sql' ],
+ [ 'renameIndex', 'module_deps', 'md_module_skin', 'PRIMARY', false,
+ 'patch-module_deps-fix-pk.sql' ],
+ [ 'renameIndex', 'objectcache', 'keyname', 'PRIMARY', false, 'patch-objectcache-fix-pk.sql' ],
+ [ 'renameIndex', 'querycache_info', 'qci_type', 'PRIMARY', false,
+ 'patch-querycache_info-fix-pk.sql' ],
+ [ 'renameIndex', 'site_stats', 'ss_row_id', 'PRIMARY', false, 'patch-site_stats-fix-pk.sql' ],
+ [ 'renameIndex', 'transcache', 'tc_url_idx', 'PRIMARY', false, 'patch-transcache-fix-pk.sql' ],
+ [ 'renameIndex', 'user_former_groups', 'ufg_user_group', 'PRIMARY', false,
+ 'patch-user_former_groups-fix-pk.sql' ],
+ [ 'renameIndex', 'user_properties', 'user_properties_user_property', 'PRIMARY', false,
+ 'patch-user_properties-fix-pk.sql' ],
];
}
// 1.30
[ 'modifyField', 'image', 'img_media_type', 'patch-add-3d.sql' ],
[ 'addTable', 'ip_changes', 'patch-ip_changes.sql' ],
+ [ 'renameIndex', 'categorylinks', 'cl_from', 'PRIMARY', false,
+ 'patch-categorylinks-fix-pk.sql' ],
+ [ 'renameIndex', 'templatelinks', 'tl_from', 'PRIMARY', false,
+ 'patch-templatelinks-fix-pk.sql' ],
+ [ 'renameIndex', 'pagelinks', 'pl_from', 'PRIMARY', false, 'patch-pagelinks-fix-pk.sql' ],
+ [ 'renameIndex', 'text', 'old_id', 'PRIMARY', false, 'patch-text-fix-pk.sql' ],
+ [ 'renameIndex', 'imagelinks', 'il_from', 'PRIMARY', false, 'patch-imagelinks-fix-pk.sql' ],
+ [ 'renameIndex', 'iwlinks', 'iwl_from', 'PRIMARY', false, 'patch-iwlinks-fix-pk.sql' ],
+ [ 'renameIndex', 'langlinks', 'll_from', 'PRIMARY', false, 'patch-langlinks-fix-pk.sql' ],
+ [ 'renameIndex', 'log_search', 'ls_field_val', 'PRIMARY', false, 'patch-log_search-fix-pk.sql' ],
+ [ 'renameIndex', 'module_deps', 'md_module_skin', 'PRIMARY', false,
+ 'patch-module_deps-fix-pk.sql' ],
+ [ 'renameIndex', 'objectcache', 'keyname', 'PRIMARY', false, 'patch-objectcache-fix-pk.sql' ],
+ [ 'renameIndex', 'querycache_info', 'qci_type', 'PRIMARY', false,
+ 'patch-querycache_info-fix-pk.sql' ],
+ [ 'renameIndex', 'site_stats', 'ss_row_id', 'PRIMARY', false, 'patch-site_stats-fix-pk.sql' ],
+ [ 'renameIndex', 'transcache', 'tc_url_idx', 'PRIMARY', false, 'patch-transcache-fix-pk.sql' ],
+ [ 'renameIndex', 'user_former_groups', 'ufg_user_group', 'PRIMARY', false,
+ 'patch-user_former_groups-fix-pk.sql' ],
+ [ 'renameIndex', 'user_properties', 'user_properties_user_property', 'PRIMARY', false,
+ 'patch-user_properties-fix-pk.sql' ],
];
}
--- /dev/null
+ALTER TABLE /*_*/categorylinks DROP KEY /*i*/cl_from, ADD PRIMARY KEY (cl_from,cl_to);
--- /dev/null
+ALTER TABLE /*_*/imagelinks DROP KEY /*i*/il_from, ADD PRIMARY KEY (il_from,il_to);
--- /dev/null
+ALTER TABLE /*_*/iwlinks DROP KEY /*i*/iwl_from, ADD PRIMARY KEY (iwl_from,iwl_prefix,iwl_title);
--- /dev/null
+ALTER TABLE /*_*/langlinks DROP KEY /*i*/ll_from, ADD PRIMARY KEY (ll_from,ll_lang);
--- /dev/null
+ALTER TABLE /*_*/log_search DROP KEY /*i*/ls_field_val, ADD PRIMARY KEY (ls_field,ls_value,ls_log_id);
--- /dev/null
+ALTER TABLE /*_*/module_deps DROP KEY /*i*/md_module_skin, ADD PRIMARY KEY (md_module,md_skin);
--- /dev/null
+ALTER TABLE /*_*/objectcache DROP KEY /*i*/keyname, ADD PRIMARY KEY (keyname);
--- /dev/null
+ALTER TABLE /*_*/pagelinks DROP INDEX /*i*/pl_from, ADD PRIMARY KEY (pl_from,pl_namespace,pl_title);
--- /dev/null
+ALTER TABLE /*_*/querycache_info DROP KEY /*i*/qci_type, ADD PRIMARY KEY (qci_type);
--- /dev/null
+ALTER TABLE /*_*/site_stats DROP KEY /*i*/ss_row_id, ADD PRIMARY KEY (ss_row_id);
--- /dev/null
+ALTER TABLE /*_*/templatelinks DROP INDEX /*i*/tl_from, ADD PRIMARY KEY (tl_from,tl_namespace,tl_title);
--- /dev/null
+ALTER TABLE /*_*/text DROP KEY /*i*/old_id, ADD PRIMARY KEY (old_id);
--- /dev/null
+ALTER TABLE /*_*/transcache DROP KEY /*i*/tc_url_idx, ADD PRIMARY KEY (tc_url);
--- /dev/null
+ALTER TABLE /*_*/user_former_groups DROP KEY /*i*/ufg_user_group, ADD PRIMARY KEY (ufg_user,ufg_group);
--- /dev/null
+ALTER TABLE /*_*/user_properties DROP KEY /*i*/user_properties_user_property, ADD PRIMARY KEY (up_user,up_property);
--- /dev/null
+CREATE TABLE /*_*/categorylinks_tmp (
+ -- Key to page_id of the page defined as a category member.
+ cl_from int unsigned NOT NULL default 0,
+
+ -- 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).
+ cl_to varchar(255) binary NOT NULL default '',
+
+ -- 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.
+ cl_sortkey varbinary(230) NOT NULL default '',
+
+ -- 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.
+ cl_sortkey_prefix varchar(255) binary NOT NULL default '',
+
+ -- This isn't really used at present. Provided for an optional
+ -- sorting method by approximate addition time.
+ cl_timestamp timestamp NOT NULL,
+
+ -- 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.
+ cl_collation varbinary(32) NOT NULL default '',
+
+ -- Stores whether cl_from is a category, file, or other page, so we can
+ -- paginate the three categories separately. This never has to be updated
+ -- after the page is created, since none of these page types can be moved to
+ -- any other.
+ cl_type ENUM('page', 'subcat', 'file') NOT NULL default 'page',
+ PRIMARY KEY (cl_from,cl_to)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/categorylinks_tmp
+ SELECT *
+ FROM /*_*/categorylinks;
+
+DROP TABLE /*_*/categorylinks;
+
+ALTER TABLE /*_*/categorylinks_tmp RENAME TO /*_*/categorylinks;
+
+-- 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?
+CREATE INDEX /*i*/cl_sortkey ON /*_*/categorylinks (cl_to,cl_type,cl_sortkey,cl_from);
+
+-- Used by the API (and some extensions)
+CREATE INDEX /*i*/cl_timestamp ON /*_*/categorylinks (cl_to,cl_timestamp);
+
+-- Used when updating collation (e.g. updateCollation.php)
+CREATE INDEX /*i*/cl_collation_ext ON /*_*/categorylinks (cl_collation, cl_to, cl_type, cl_from);
\ No newline at end of file
--- /dev/null
+CREATE TABLE /*_*/imagelinks_tmp (
+ -- Key to page_id of the page containing the image / media link.
+ il_from int unsigned NOT NULL default 0,
+ -- Namespace for this page
+ il_from_namespace int NOT NULL default 0,
+
+ -- 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).
+ il_to varchar(255) binary NOT NULL default '',
+ PRIMARY KEY (il_from,il_to)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/imagelinks_tmp
+ SELECT * FROM /*_*/imagelinks;
+
+DROP TABLE /*_*/imagelinks;
+
+ALTER TABLE /*_*/imagelinks_tmp RENAME TO /*_*/imagelinks;
+
+-- Reverse index, for Special:Whatlinkshere and file description page local usage
+CREATE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from);
+
+-- Index for Special:Whatlinkshere with namespace filter
+CREATE INDEX /*i*/il_backlinks_namespace ON /*_*/imagelinks (il_from_namespace,il_to,il_from);
\ No newline at end of file
--- /dev/null
+CREATE TABLE /*_*/iwlinks_tmp (
+ -- page_id of the referring page
+ iwl_from int unsigned NOT NULL default 0,
+
+ -- Interwiki prefix code of the target
+ iwl_prefix varbinary(20) NOT NULL default '',
+
+ -- Title of the target, including namespace
+ iwl_title varchar(255) binary NOT NULL default '',
+ PRIMARY KEY (iwl_from,iwl_prefix,iwl_title)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/iwlinks_tmp
+ SELECT * FROM /*_*/iwlinks;
+
+DROP TABLE /*_*/iwlinks;
+
+ALTER TABLE /*_*/iwlinks_tmp RENAME TO /*_*/iwlinks;
+
+-- Index for ApiQueryIWBacklinks
+CREATE INDEX /*i*/iwl_prefix_title_from ON /*_*/iwlinks (iwl_prefix, iwl_title, iwl_from);
+
+-- Index for ApiQueryIWLinks
+CREATE INDEX /*i*/iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title);
\ No newline at end of file
--- /dev/null
+CREATE TABLE /*_*/langlinks_tmp (
+ -- page_id of the referring page
+ ll_from int unsigned NOT NULL default 0,
+
+ -- Language code of the target
+ ll_lang varbinary(20) NOT NULL default '',
+
+ -- Title of the target, including namespace
+ ll_title varchar(255) binary NOT NULL default '',
+ PRIMARY KEY (ll_from,ll_lang)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/langlinks_tmp
+ SELECT * FROM /*_*/langlinks;
+
+DROP TABLE /*_*/langlinks;
+
+ALTER TABLE /*_*/langlinks_tmp RENAME TO /*_*/langlinks;
+
+-- Index for ApiQueryLangbacklinks
+CREATE INDEX /*i*/ll_lang ON /*_*/langlinks (ll_lang, ll_title);
\ No newline at end of file
--- /dev/null
+CREATE TABLE /*_*/log_search_tmp (
+ -- The type of ID (rev ID, log ID, rev timestamp, username)
+ ls_field varbinary(32) NOT NULL,
+ -- The value of the ID
+ ls_value varchar(255) NOT NULL,
+ -- Key to log_id
+ ls_log_id int unsigned NOT NULL default 0,
+ PRIMARY KEY (ls_field,ls_value,ls_log_id)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/log_search_tmp
+ SELECT * FROM /*_*/log_search;
+
+DROP TABLE /*_*/log_search;
+
+ALTER TABLE /*_*/log_search_tmp RENAME TO /*_*/log_search;
+
+CREATE INDEX /*i*/ls_log_id ON /*_*/log_search (ls_log_id);
\ No newline at end of file
--- /dev/null
+CREATE TABLE /*_*/module_deps_tmp (
+ -- Module name
+ md_module varbinary(255) NOT NULL,
+ -- Module context vary (includes skin and language; called "md_skin" for legacy reasons)
+ md_skin varbinary(32) NOT NULL,
+ -- JSON blob with file dependencies
+ md_deps mediumblob NOT NULL,
+ PRIMARY KEY (md_module,md_skin)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/module_deps_tmp
+ SELECT * FROM /*_*/module_deps;
+
+DROP TABLE /*_*/module_deps;
+
+ALTER TABLE /*_*/module_deps_tmp RENAME TO /*_*/module_deps;
\ No newline at end of file
--- /dev/null
+CREATE TABLE /*_*/objectcache_tmp (
+ keyname varbinary(255) NOT NULL default '' PRIMARY KEY,
+ value mediumblob,
+ exptime datetime
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/objectcache_tmp
+ SELECT * FROM /*_*/objectcache;
+
+DROP TABLE /*_*/objectcache;
+
+ALTER TABLE /*_*/objectcache_tmp RENAME TO /*_*/objectcache;
+
+CREATE INDEX /*i*/exptime ON /*_*/objectcache (exptime);
\ No newline at end of file
--- /dev/null
+CREATE TABLE /*_*/pagelinks_tmp (
+ -- Key to the page_id of the page containing the link.
+ pl_from int unsigned NOT NULL default 0,
+ -- Namespace for this page
+ pl_from_namespace int NOT NULL default 0,
+
+ -- Key to page_namespace/page_title of the target page.
+ -- The target page may or may not exist, and due to renames
+ -- and deletions may refer to different page records as time
+ -- goes by.
+ pl_namespace int NOT NULL default 0,
+ pl_title varchar(255) binary NOT NULL default '',
+ PRIMARY KEY (pl_from,pl_namespace,pl_title)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/pagelinks_tmp
+ SELECT * FROM /*_*/pagelinks;
+
+DROP TABLE /*_*/pagelinks;
+
+ALTER TABLE /*_*/pagelinks_tmp RENAME TO /*_*/pagelinks;
+
+-- Reverse index, for Special:Whatlinkshere
+CREATE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from);
+
+-- Index for Special:Whatlinkshere with namespace filter
+CREATE INDEX /*i*/pl_backlinks_namespace ON /*_*/pagelinks (pl_from_namespace,pl_namespace,pl_title,pl_from);
--- /dev/null
+CREATE TABLE /*_*/querycache_info_tmp (
+ -- Special page name
+ -- Corresponds to a qc_type value
+ qci_type varbinary(32) NOT NULL default '' PRIMARY KEY,
+
+ -- Timestamp of last update
+ qci_timestamp binary(14) NOT NULL default '19700101000000'
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/querycache_info_tmp
+ SELECT * FROM /*_*/querycache_info;
+
+DROP TABLE /*_*/querycache_info;
+
+ALTER TABLE /*_*/querycache_info_tmp RENAME TO /*_*/querycache_info;
\ No newline at end of file
--- /dev/null
+CREATE TABLE /*_*/site_stats_tmp (
+ -- The single row should contain 1 here.
+ ss_row_id int unsigned NOT NULL PRIMARY KEY,
+
+ -- Total number of edits performed.
+ ss_total_edits bigint unsigned default 0,
+
+ -- An approximate count of pages matching the following criteria:
+ -- * in namespace 0
+ -- * not a redirect
+ -- * contains the text '[['
+ -- See Article::isCountable() in includes/Article.php
+ ss_good_articles bigint unsigned default 0,
+
+ -- Total pages, theoretically equal to SELECT COUNT(*) FROM page; except faster
+ ss_total_pages bigint default '-1',
+
+ -- Number of users, theoretically equal to SELECT COUNT(*) FROM user;
+ ss_users bigint default '-1',
+
+ -- Number of users that still edit
+ ss_active_users bigint default '-1',
+
+ -- Number of images, equivalent to SELECT COUNT(*) FROM image
+ ss_images int default 0
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/site_stats_tmp
+ SELECT * FROM /*_*/site_stats;
+
+DROP TABLE /*_*/site_stats;
+
+ALTER TABLE /*_*/site_stats_tmp RENAME TO /*_*/site_stats;
\ No newline at end of file
--- /dev/null
+CREATE TABLE /*_*/templatelinks_tmp (
+ -- Key to the page_id of the page containing the link.
+ tl_from int unsigned NOT NULL default 0,
+ -- Namespace for this page
+ tl_from_namespace int NOT NULL default 0,
+
+ -- Key to page_namespace/page_title of the target page.
+ -- The target page may or may not exist, and due to renames
+ -- and deletions may refer to different page records as time
+ -- goes by.
+ tl_namespace int NOT NULL default 0,
+ tl_title varchar(255) binary NOT NULL default '',
+ PRIMARY KEY (tl_from,tl_namespace,tl_title)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/templatelinks_tmp
+ SELECT * FROM /*_*/templatelinks;
+
+DROP TABLE /*_*/templatelinks;
+
+ALTER TABLE /*_*/templatelinks_tmp RENAME TO /*_*/templatelinks;
+
+-- Reverse index, for Special:Whatlinkshere
+CREATE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from);
+
+-- Index for Special:Whatlinkshere with namespace filter
+CREATE INDEX /*i*/tl_backlinks_namespace ON /*_*/templatelinks (tl_from_namespace,tl_namespace,tl_title,tl_from);
--- /dev/null
+CREATE TABLE /*_*/text_tmp (
+ -- Unique text storage key number.
+ -- Note that the 'oldid' parameter used in URLs does *not*
+ -- refer to this number anymore, but to rev_id.
+ --
+ -- revision.rev_text_id is a key to this column
+ old_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
+
+ -- Depending on the contents of the old_flags field, the text
+ -- may be convenient plain text, or it may be funkily encoded.
+ old_text mediumblob NOT NULL,
+
+ -- Comma-separated list of flags:
+ -- gzip: text is compressed with PHP's gzdeflate() function.
+ -- 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).
+ -- 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.
+ -- 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.
+ old_flags tinyblob NOT NULL
+) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=10240;
+
+INSERT INTO /*_*/text_tmp
+ SELECT * FROM /*_*/text;
+
+DROP TABLE /*_*/text;
+
+ALTER TABLE /*_*/text_tmp RENAME TO /*_*/text;
\ No newline at end of file
--- /dev/null
+CREATE TABLE /*_*/transcache_tmp (
+ tc_url varbinary(255) NOT NULL PRIMARY KEY,
+ tc_contents text,
+ tc_time binary(14) NOT NULL
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/transcache_tmp
+ SELECT * FROM /*_*/transcache;
+
+DROP TABLE /*_*/transcache;
+
+ALTER TABLE /*_*/transcache_tmp RENAME TO /*_*/transcache;
\ No newline at end of file
--- /dev/null
+CREATE TABLE /*_*/user_former_groups_tmp (
+ -- Key to user_id
+ ufg_user int unsigned NOT NULL default 0,
+ ufg_group varbinary(255) NOT NULL default '',
+ PRIMARY KEY (ufg_user,ufg_group)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/user_former_groups_tmp
+ SELECT * FROM /*_*/user_former_groups;
+
+DROP TABLE /*_*/user_former_groups;
+
+ALTER TABLE /*_*/user_former_groups_tmp RENAME TO /*_*/user_former_groups;
\ No newline at end of file
--- /dev/null
+CREATE TABLE /*_*/user_properties_tmp (
+ -- Foreign key to user.user_id
+ up_user int NOT NULL,
+
+ -- Name of the option being saved. This is indexed for bulk lookup.
+ up_property varbinary(255) NOT NULL,
+
+ -- Property value as a string.
+ up_value blob,
+ PRIMARY KEY (up_user,up_property)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/user_properties_tmp
+ SELECT * FROM /*_*/user_properties;
+
+DROP TABLE /*_*/user_properties;
+
+ALTER TABLE /*_*/user_properties_tmp RENAME TO /*_*/user_properties;
+
+CREATE INDEX /*i*/user_properties_property ON /*_*/user_properties (up_property);
\ No newline at end of file
CREATE TABLE /*_*/user_former_groups (
-- Key to user_id
ufg_user int unsigned NOT NULL default 0,
- ufg_group varbinary(255) NOT NULL default ''
+ ufg_group varbinary(255) NOT NULL default '',
+ PRIMARY KEY (ufg_user,ufg_group)
) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/ufg_user_group ON /*_*/user_former_groups (ufg_user,ufg_group);
-
--
-- Stores notifications of user talk page changes, for the display
-- of the "you have new messages" box
up_property varbinary(255) NOT NULL,
-- Property value as a string.
- up_value blob
+ up_value blob,
+ PRIMARY KEY (up_user,up_property)
) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/user_properties_user_property ON /*_*/user_properties (up_user,up_property);
CREATE INDEX /*i*/user_properties_property ON /*_*/user_properties (up_property);
--
-- and deletions may refer to different page records as time
-- goes by.
pl_namespace int NOT NULL default 0,
- pl_title varchar(255) binary NOT NULL default ''
+ pl_title varchar(255) binary NOT NULL default '',
+ PRIMARY KEY (pl_from,pl_namespace,pl_title)
) /*$wgDBTableOptions*/;
--- Forward index, for page edit, save
-CREATE UNIQUE INDEX /*i*/pl_from ON /*_*/pagelinks (pl_from,pl_namespace,pl_title);
-
-- Reverse index, for Special:Whatlinkshere
CREATE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from);
-- and deletions may refer to different page records as time
-- goes by.
tl_namespace int NOT NULL default 0,
- tl_title varchar(255) binary NOT NULL default ''
+ tl_title varchar(255) binary NOT NULL default '',
+ PRIMARY KEY (tl_from,tl_namespace,tl_title)
) /*$wgDBTableOptions*/;
--- Forward index, for page edit, save
-CREATE UNIQUE INDEX /*i*/tl_from ON /*_*/templatelinks (tl_from,tl_namespace,tl_title);
-
-- Reverse index, for Special:Whatlinkshere
CREATE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from);
-- 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).
- il_to varchar(255) binary NOT NULL default ''
+ il_to varchar(255) binary NOT NULL default '',
+ PRIMARY KEY (il_from,il_to)
) /*$wgDBTableOptions*/;
--- Forward index, for cache invalidation on file update, etc.
-CREATE UNIQUE INDEX /*i*/il_from ON /*_*/imagelinks (il_from,il_to);
-
-- Reverse index, for Special:Whatlinkshere and file description page local usage
CREATE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from);
-- paginate the three categories separately. This never has to be updated
-- after the page is created, since none of these page types can be moved to
-- any other.
- cl_type ENUM('page', 'subcat', 'file') NOT NULL default 'page'
+ cl_type ENUM('page', 'subcat', 'file') NOT NULL default 'page',
+ PRIMARY KEY (cl_from,cl_to)
) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/cl_from ON /*_*/categorylinks (cl_from,cl_to);
-- 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
ll_lang varbinary(20) NOT NULL default '',
-- Title of the target, including namespace
- ll_title varchar(255) binary NOT NULL default ''
+ ll_title varchar(255) binary NOT NULL default '',
+ PRIMARY KEY (ll_from,ll_lang)
) /*$wgDBTableOptions*/;
--- Forward index, for page edit, save, ApiQueryLanglinks
-CREATE UNIQUE INDEX /*i*/ll_from ON /*_*/langlinks (ll_from, ll_lang);
-
-- Index for ApiQueryLangbacklinks
CREATE INDEX /*i*/ll_lang ON /*_*/langlinks (ll_lang, ll_title);
iwl_prefix varbinary(20) NOT NULL default '',
-- Title of the target, including namespace
- iwl_title varchar(255) binary NOT NULL default ''
+ iwl_title varchar(255) binary NOT NULL default '',
+ PRIMARY KEY (iwl_from,iwl_prefix,iwl_title)
) /*$wgDBTableOptions*/;
--- Forward index, for page edit, save, ApiQueryIWLinks
-CREATE UNIQUE INDEX /*i*/iwl_from ON /*_*/iwlinks (iwl_from, iwl_prefix, iwl_title);
-
-- Index for ApiQueryIWBacklinks
CREATE INDEX /*i*/iwl_prefix_title_from ON /*_*/iwlinks (iwl_prefix, iwl_title, iwl_from);
--
CREATE TABLE /*_*/site_stats (
-- The single row should contain 1 here.
- ss_row_id int unsigned NOT NULL,
+ ss_row_id int unsigned NOT NULL PRIMARY KEY,
-- Total number of edits performed.
ss_total_edits bigint unsigned default 0,
ss_images int default 0
) /*$wgDBTableOptions*/;
--- Pointless index to assuage developer superstitions
-CREATE UNIQUE INDEX /*i*/ss_row_id ON /*_*/site_stats (ss_row_id);
-
--
-- The internet is full of jerks, alas. Sometimes it's handy
-- to block a vandal or troll account.
-- Cache of interwiki transclusion
--
CREATE TABLE /*_*/transcache (
- tc_url varbinary(255) NOT NULL,
+ tc_url varbinary(255) NOT NULL PRIMARY KEY,
tc_contents text,
tc_time binary(14) NOT NULL
) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/tc_url_idx ON /*_*/transcache (tc_url);
-
CREATE TABLE /*_*/logging (
-- Log ID, for referring to this specific log entry, probably for deletion and such.
-- The value of the ID
ls_value varchar(255) NOT NULL,
-- Key to log_id
- ls_log_id int unsigned NOT NULL default 0
+ ls_log_id int unsigned NOT NULL default 0,
+ PRIMARY KEY (ls_field,ls_value,ls_log_id)
) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/ls_field_val ON /*_*/log_search (ls_field,ls_value,ls_log_id);
CREATE INDEX /*i*/ls_log_id ON /*_*/log_search (ls_log_id);
CREATE TABLE /*_*/querycache_info (
-- Special page name
-- Corresponds to a qc_type value
- qci_type varbinary(32) NOT NULL default '',
+ qci_type varbinary(32) NOT NULL default '' PRIMARY KEY,
-- Timestamp of last update
qci_timestamp binary(14) NOT NULL default '19700101000000'
) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/qci_type ON /*_*/querycache_info (qci_type);
-
-- For each redirect, this table contains exactly one row defining its target
CREATE TABLE /*_*/redirect (
-- Module context vary (includes skin and language; called "md_skin" for legacy reasons)
md_skin varbinary(32) NOT NULL,
-- JSON blob with file dependencies
- md_deps mediumblob NOT NULL
+ md_deps mediumblob NOT NULL,
+ PRIMARY KEY (md_module,md_skin)
) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/md_module_skin ON /*_*/module_deps (md_module, md_skin);
-- Holds all the sites known to the wiki.
CREATE TABLE /*_*/sites (