diff options
Diffstat (limited to 'maintenance/tables.sql')
-rw-r--r-- | maintenance/tables.sql | 73 |
1 files changed, 51 insertions, 22 deletions
diff --git a/maintenance/tables.sql b/maintenance/tables.sql index de92ef53..02286848 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -126,7 +126,12 @@ CREATE TABLE /*_*/user ( -- Meant primarily for heuristic checks to give an impression of whether -- the account has been used much. -- - user_editcount int + user_editcount int, + + -- Expiration date for user password. Use $user->expirePassword() + -- to force a password reset. + user_password_expires varbinary(14) DEFAULT NULL + ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/user_name ON /*_*/user (user_name); @@ -256,6 +261,11 @@ CREATE TABLE /*_*/page ( -- of contained templates. page_touched binary(14) NOT NULL default '', + -- 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. + page_links_updated varbinary(14) NULL default NULL, + -- 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. @@ -265,7 +275,10 @@ CREATE TABLE /*_*/page ( page_len int unsigned NOT NULL, -- content model, see CONTENT_MODEL_XXX constants - page_content_model varbinary(32) DEFAULT NULL + page_content_model varbinary(32) DEFAULT NULL, + + -- Page content language + page_lang varbinary(35) DEFAULT NULL ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/name_title ON /*_*/page (page_namespace,page_title); @@ -460,6 +473,8 @@ CREATE INDEX /*i*/ar_revid ON /*_*/archive (ar_rev_id); CREATE TABLE /*_*/pagelinks ( -- 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 @@ -470,7 +485,8 @@ CREATE TABLE /*_*/pagelinks ( ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/pl_from ON /*_*/pagelinks (pl_from,pl_namespace,pl_title); -CREATE UNIQUE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from); +CREATE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from); +CREATE INDEX /*i*/pl_backlinks_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from_namespace,pl_from); -- @@ -479,6 +495,8 @@ CREATE UNIQUE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,p CREATE TABLE /*_*/templatelinks ( -- 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 @@ -489,7 +507,8 @@ CREATE TABLE /*_*/templatelinks ( ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/tl_from ON /*_*/templatelinks (tl_from,tl_namespace,tl_title); -CREATE UNIQUE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from); +CREATE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from); +CREATE INDEX /*i*/tl_backlinks_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from_namespace,tl_from); -- @@ -500,6 +519,8 @@ CREATE UNIQUE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace,tl_tit CREATE TABLE /*_*/imagelinks ( -- 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; @@ -508,7 +529,8 @@ CREATE TABLE /*_*/imagelinks ( ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/il_from ON /*_*/imagelinks (il_from,il_to); -CREATE UNIQUE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from); +CREATE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from); +CREATE INDEX /*i*/il_backlinks_namespace ON /*_*/imagelinks (il_to,il_from_namespace,il_from); -- @@ -714,7 +736,7 @@ CREATE UNIQUE INDEX /*i*/ss_row_id ON /*_*/site_stats (ss_row_id); -- CREATE TABLE /*_*/hitcounter ( hc_id int unsigned NOT NULL -) ENGINE=HEAP MAX_ROWS=25000; +) ENGINE=MEMORY MAX_ROWS=25000; -- @@ -825,7 +847,8 @@ CREATE TABLE /*_*/image ( -- major part of a MIME media type as defined by IANA -- see http://www.iana.org/assignments/media-types/ - img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") NOT NULL default "unknown", + -- for "chemical" cf. http://dx.doi.org/10.1021/ci9803233 by the ACS + img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown", -- minor part of a MIME media type as defined by IANA -- the minor parts are not required to adher to any standard @@ -884,7 +907,7 @@ CREATE TABLE /*_*/oldimage ( oi_metadata mediumblob NOT NULL, oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, - oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") NOT NULL default "unknown", + oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown", oi_minor_mime varbinary(100) NOT NULL default "unknown", oi_deleted tinyint unsigned NOT NULL default 0, oi_sha1 varbinary(32) NOT NULL default '' @@ -934,7 +957,7 @@ CREATE TABLE /*_*/filearchive ( fa_metadata mediumblob, fa_bits int default 0, fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, - fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") default "unknown", + 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 tinyblob, fa_user int unsigned default 0, @@ -991,12 +1014,12 @@ CREATE TABLE /*_*/uploadstash ( -- chunk counter starts at 0, current offset is stored in us_size us_chunk_inx int unsigned NULL, - -- Serialized file properties from File::getPropsFromPath + -- Serialized file properties from FSFile::getProps() us_props blob, -- file size in bytes us_size int unsigned NOT NULL, - -- this hash comes from File::sha1Base36(), and is 31 characters + -- this hash comes from FSFile::getSha1Base36(), and is 31 characters us_sha1 varchar(31) NOT NULL, us_mime varchar(255), -- Media type as defined by the MEDIATYPE_xxx constants, should duplicate definition in the image table @@ -1025,9 +1048,6 @@ CREATE TABLE /*_*/recentchanges ( rc_id int NOT NULL PRIMARY KEY AUTO_INCREMENT, rc_timestamp varbinary(14) NOT NULL default '', - -- This is no longer used - rc_cur_time varbinary(14) NOT NULL default '', - -- As in revision rc_user int unsigned NOT NULL default 0, rc_user_text varchar(255) binary NOT NULL, @@ -1062,6 +1082,10 @@ CREATE TABLE /*_*/recentchanges ( -- The type of change entry (RC_EDIT,RC_NEW,RC_LOG,RC_EXTERNAL) rc_type tinyint unsigned NOT NULL default 0, + -- The source of the change entry (replaces rc_type) + -- default of '' is temporary, needed for initial migration + rc_source varchar(16) binary not null default '', + -- 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. @@ -1109,14 +1133,16 @@ CREATE TABLE /*_*/watchlist ( wl_namespace int NOT NULL default 0, wl_title varchar(255) binary NOT NULL default '', - -- Timestamp when user was last sent a notification e-mail; - -- cleared when the user visits the page. + -- Timestamp used to send notification e-mails and show "updated since last visit" markers on + -- history and recent changes / watchlist. 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. wl_notificationtimestamp varbinary(14) ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/wl_user ON /*_*/watchlist (wl_user, wl_namespace, wl_title); CREATE INDEX /*i*/namespace_title ON /*_*/watchlist (wl_namespace, wl_title); +CREATE INDEX /*i*/wl_user_notificationtimestamp ON /*_*/watchlist (wl_user, wl_notificationtimestamp); -- @@ -1256,6 +1282,8 @@ CREATE INDEX /*i*/times ON /*_*/logging (log_timestamp); CREATE INDEX /*i*/log_user_type_time ON /*_*/logging (log_user, log_type, log_timestamp); CREATE INDEX /*i*/log_page_id_time ON /*_*/logging (log_page,log_timestamp); CREATE INDEX /*i*/type_action ON /*_*/logging (log_type, log_action, log_timestamp); +CREATE INDEX /*i*/log_user_text_type_time ON /*_*/logging (log_user_text, log_type, log_timestamp); +CREATE INDEX /*i*/log_user_text_time ON /*_*/logging (log_user_text, log_timestamp); CREATE TABLE /*_*/log_search ( @@ -1369,6 +1397,8 @@ CREATE INDEX /*i*/qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo, -- Used for storing page restrictions (i.e. protection levels) CREATE TABLE /*_*/page_restrictions ( + -- Field for an ID for this restrictions row (sort-key for Special:ProtectedPages) + pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, -- Page to apply restrictions to (Foreign Key to page). pr_page int NOT NULL, -- The protection type (edit, move, etc) @@ -1380,9 +1410,7 @@ CREATE TABLE /*_*/page_restrictions ( -- Field for future support of per-user restriction. pr_user int NULL, -- Field for time-limited protection. - pr_expiry varbinary(14) NULL, - -- Field for an ID for this restrictions row (sort-key for Special:ProtectedPages) - pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT + pr_expiry varbinary(14) NULL ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/pr_pagetype ON /*_*/page_restrictions (pr_page,pr_type); @@ -1410,12 +1438,13 @@ CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles (pt_timestamp); CREATE TABLE /*_*/page_props ( pp_page int NOT NULL, pp_propname varbinary(60) NOT NULL, - pp_value blob NOT NULL + pp_value blob NOT NULL, + pp_sortkey float DEFAULT NULL ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/pp_page_propname ON /*_*/page_props (pp_page,pp_propname); CREATE UNIQUE INDEX /*i*/pp_propname_page ON /*_*/page_props (pp_propname,pp_page); - +CREATE UNIQUE INDEX /*i*/pp_propname_sortkey_page ON /*_*/page_props (pp_propname,pp_sortkey,pp_page); -- A table to log updates, one text key row per update. CREATE TABLE /*_*/updatelog ( @@ -1514,7 +1543,7 @@ 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 ( --- Numeric id of the site + -- Numeric id of the site site_id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, -- Global identifier for the site, ie 'enwiktionary' |