2005-05-02 08:07:38 +00:00
|
|
|
-- SQL to create the initial tables for the MediaWiki database.
|
2003-04-14 23:10:40 +00:00
|
|
|
-- This is read and executed by the install script; you should
|
2005-05-02 08:07:38 +00:00
|
|
|
-- not have to run it by itself unless doing a manual install.
|
|
|
|
|
|
2009-01-15 06:56:58 +00:00
|
|
|
-- This is a shared schema file used for both MySQL and SQLite installs.
|
2015-09-01 22:11:19 +00:00
|
|
|
--
|
|
|
|
|
-- For more documentation on the database schema, see
|
|
|
|
|
-- https://www.mediawiki.org/wiki/Manual:Database_layout
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
|
|
|
|
-- General notes:
|
|
|
|
|
--
|
|
|
|
|
-- If possible, create tables as InnoDB to benefit from the
|
|
|
|
|
-- superior resiliency against crashes and ability to read
|
|
|
|
|
-- during writes (and write during reads!)
|
|
|
|
|
--
|
|
|
|
|
-- Only the 'searchindex' table requires MyISAM due to the
|
|
|
|
|
-- requirement for fulltext index support, which is missing
|
|
|
|
|
-- from InnoDB.
|
|
|
|
|
--
|
|
|
|
|
--
|
|
|
|
|
-- The MySQL table backend for MediaWiki currently uses
|
2007-06-22 18:31:24 +00:00
|
|
|
-- 14-character BINARY or VARBINARY fields to store timestamps.
|
2005-05-02 08:07:38 +00:00
|
|
|
-- The format is YYYYMMDDHHMMSS, which is derived from the
|
|
|
|
|
-- text format of MySQL's TIMESTAMP fields.
|
|
|
|
|
--
|
|
|
|
|
-- Historically TIMESTAMP fields were used, but abandoned
|
|
|
|
|
-- in early 2002 after a lot of trouble with the fields
|
|
|
|
|
-- auto-updating.
|
|
|
|
|
--
|
2012-04-07 00:22:19 +00:00
|
|
|
-- The Postgres backend uses TIMESTAMPTZ fields for timestamps,
|
2005-05-02 08:07:38 +00:00
|
|
|
-- and we will migrate the MySQL definitions at some point as
|
|
|
|
|
-- well.
|
|
|
|
|
--
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
-- The /*_*/ comments in this and other files are
|
2005-05-02 08:07:38 +00:00
|
|
|
-- replaced with the defined table prefix by the installer
|
|
|
|
|
-- and updater scripts. If you are installing or running
|
|
|
|
|
-- updates manually, you will need to manually insert the
|
|
|
|
|
-- table prefix if any when running these scripts.
|
2003-04-14 23:10:40 +00:00
|
|
|
--
|
|
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- 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 when a external authentication plugin is used,
|
|
|
|
|
-- user table entries still need to be created to store
|
|
|
|
|
-- preferences and to key tracking information in the other
|
|
|
|
|
-- tables.
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/user (
|
|
|
|
|
user_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Usernames must be unique, must not be in the form of
|
|
|
|
|
-- an IP address. _Shouldn't_ allow slashes or case
|
|
|
|
|
-- conflicts. Spaces are allowed, and are _not_ converted
|
2005-10-14 06:27:43 +00:00
|
|
|
-- to underscores like titles. See the User::newFromName() for
|
|
|
|
|
-- the specific tests that usernames have to pass.
|
2011-01-20 23:56:47 +00:00
|
|
|
user_name varchar(255) binary NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Optional 'real name' to be displayed in credit listings
|
2011-01-20 23:56:47 +00:00
|
|
|
user_real_name varchar(255) binary NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2010-10-09 13:34:19 +00:00
|
|
|
-- Password hashes, see User::crypt() and User::comparePasswords()
|
|
|
|
|
-- in User.php for the algorithm
|
2006-12-21 21:40:43 +00:00
|
|
|
user_password tinyblob NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- 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.
|
2006-12-21 21:40:43 +00:00
|
|
|
user_newpassword tinyblob NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2006-10-23 09:35:30 +00:00
|
|
|
-- Timestamp of the last time when a new password was
|
2010-12-27 17:17:45 +00:00
|
|
|
-- 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.
|
2007-06-22 18:31:24 +00:00
|
|
|
user_newpass_time binary(14),
|
2006-10-23 09:35:30 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Note: email should be restricted, not public info.
|
2005-05-03 07:30:20 +00:00
|
|
|
-- Same with passwords.
|
2006-12-21 21:40:43 +00:00
|
|
|
user_email tinytext NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2013-03-12 00:32:54 +00:00
|
|
|
-- 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.
|
2007-06-22 18:31:24 +00:00
|
|
|
user_touched binary(14) NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- 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)
|
2007-06-22 18:31:24 +00:00
|
|
|
user_token binary(32) NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- 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.
|
2007-06-22 18:31:24 +00:00
|
|
|
user_email_authenticated binary(14),
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Randomly generated token created when the e-mail address
|
|
|
|
|
-- is set and a confirmation test mail sent.
|
2007-06-22 18:31:24 +00:00
|
|
|
user_email_token binary(32),
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-10-14 06:27:43 +00:00
|
|
|
-- Expiration date for the user_email_token
|
2007-06-22 18:31:24 +00:00
|
|
|
user_email_token_expires binary(14),
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
-- Timestamp of account registration.
|
|
|
|
|
-- Accounts predating this schema addition may contain NULL.
|
2007-06-22 18:31:24 +00:00
|
|
|
user_registration binary(14),
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2006-12-14 13:22:52 +00:00
|
|
|
-- Count of edits and edit-like actions.
|
|
|
|
|
--
|
2019-11-21 20:47:13 +00:00
|
|
|
-- *NOT* intended to be an accurate copy of COUNT(*) WHERE rev_actor refers to a user's actor_id
|
2006-12-14 13:22:52 +00:00
|
|
|
-- 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.
|
|
|
|
|
--
|
Password Expiration
Add functionality to expire users' passwords:
* Adds column to the user table to keep a password expiration
* Adds $wgPasswordExpirationDays, which will force users to reset
their passwords after a set number of days. By default, this set
to false, so passwords never expire.
* Adds a default grace period of 7 days, where if the user's password
is expired, they can still login, but are encouraged to reset their
password.
* Adds hook 'LoginPasswordResetMessage' to update reset message, in
case an extension wants to vary the message on a particular reset
event.
* Adds hook 'ResetPasswordExpiration' to allow extensions to change
the expiration date when the user resets their password. E.g., if
an extension wants to vary the expiration based on the user's group.
If the user is in the grace period, they get a password reset form
added to the login successful page. If an extension prevents showing
the login successful page (like CentralAuth), it should be updated to
show a password change form during the grace period. After the grace
period, the user will not be able to login without changing their
password.
Also prevents a successful reset if the user is "changing" their
password to their existing password.
No passwords will expire by default. Sites will have to call
User->expirePassword() from their own maintenance script to trigger a
password reset for a user.
Bug: 54997
Change-Id: I92a9fc63b409b182b1d7b48781d73fc7216f8061
2013-10-09 18:09:28 +00:00
|
|
|
user_editcount int,
|
|
|
|
|
|
2015-09-04 16:17:42 +00:00
|
|
|
-- Expiration date for user password.
|
Password Expiration
Add functionality to expire users' passwords:
* Adds column to the user table to keep a password expiration
* Adds $wgPasswordExpirationDays, which will force users to reset
their passwords after a set number of days. By default, this set
to false, so passwords never expire.
* Adds a default grace period of 7 days, where if the user's password
is expired, they can still login, but are encouraged to reset their
password.
* Adds hook 'LoginPasswordResetMessage' to update reset message, in
case an extension wants to vary the message on a particular reset
event.
* Adds hook 'ResetPasswordExpiration' to allow extensions to change
the expiration date when the user resets their password. E.g., if
an extension wants to vary the expiration based on the user's group.
If the user is in the grace period, they get a password reset form
added to the login successful page. If an extension prevents showing
the login successful page (like CentralAuth), it should be updated to
show a password change form during the grace period. After the grace
period, the user will not be able to login without changing their
password.
Also prevents a successful reset if the user is "changing" their
password to their existing password.
No passwords will expire by default. Sites will have to call
User->expirePassword() from their own maintenance script to trigger a
password reset for a user.
Bug: 54997
Change-Id: I92a9fc63b409b182b1d7b48781d73fc7216f8061
2013-10-09 18:09:28 +00:00
|
|
|
user_password_expires varbinary(14) DEFAULT NULL
|
|
|
|
|
|
2009-01-15 06:56:58 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2005-04-26 19:57:55 +00:00
|
|
|
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/user_name ON /*_*/user (user_name);
|
|
|
|
|
CREATE INDEX /*i*/user_email_token ON /*_*/user (user_email_token);
|
2011-07-23 08:15:11 +00:00
|
|
|
CREATE INDEX /*i*/user_email ON /*_*/user (user_email(50));
|
2005-05-02 08:40:17 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
|
|
|
|
-- Core of the wiki: each page has an entry here which identifies
|
|
|
|
|
-- it by title and contains some essential metadata.
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/page (
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Unique identifier number. The page_id will be preserved across
|
|
|
|
|
-- edits and rename operations, but not deletions and recreations.
|
2009-01-15 06:56:58 +00:00
|
|
|
page_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- A page name is broken into a namespace and a title.
|
|
|
|
|
-- The namespace keys are UI-language-independent constants,
|
2005-10-14 06:27:43 +00:00
|
|
|
-- defined in includes/Defines.php
|
2005-05-02 10:15:02 +00:00
|
|
|
page_namespace int NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- The rest of the title, as text.
|
|
|
|
|
-- Spaces are transformed into underscores in title storage.
|
2011-01-20 23:56:47 +00:00
|
|
|
page_title varchar(255) binary NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Comma-separated set of permission keys indicating who
|
|
|
|
|
-- can move or edit the page.
|
2020-03-18 23:33:48 +00:00
|
|
|
page_restrictions tinyblob NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- 1 indicates the article is a redirect.
|
2009-01-15 06:56:58 +00:00
|
|
|
page_is_redirect tinyint unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- 1 indicates this is a new entry, with only one edit.
|
|
|
|
|
-- Not all pages with one edit are new pages.
|
2009-01-15 06:56:58 +00:00
|
|
|
page_is_new tinyint unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Random value between 0 and 1, used for Special:Randompage
|
2004-12-19 08:00:50 +00:00
|
|
|
page_random real unsigned NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- This timestamp is updated whenever the page changes in
|
|
|
|
|
-- a way requiring it to be re-rendered, invalidating caches.
|
2005-05-03 07:30:20 +00:00
|
|
|
-- Aside from editing this includes permission changes,
|
2005-05-02 08:07:38 +00:00
|
|
|
-- creation or deletion of linked pages, and alteration
|
|
|
|
|
-- of contained templates.
|
2007-06-22 18:31:24 +00:00
|
|
|
page_touched binary(14) NOT NULL default '',
|
2005-05-02 08:07:38 +00:00
|
|
|
|
2013-12-13 00:54:51 +00:00
|
|
|
-- 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,
|
|
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- 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.
|
2007-06-22 18:31:24 +00:00
|
|
|
page_latest int unsigned NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Uncompressed length in bytes of the page's current source text.
|
2012-03-06 17:35:24 +00:00
|
|
|
page_len int unsigned NOT NULL,
|
|
|
|
|
|
2012-05-13 22:02:29 +00:00
|
|
|
-- content model, see CONTENT_MODEL_XXX constants
|
2014-05-25 14:38:50 +00:00
|
|
|
page_content_model varbinary(32) DEFAULT NULL,
|
|
|
|
|
|
|
|
|
|
-- Page content language
|
|
|
|
|
page_lang varbinary(35) DEFAULT NULL
|
2009-01-15 06:56:58 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2004-12-19 08:00:50 +00:00
|
|
|
|
2017-04-24 06:49:05 +00:00
|
|
|
-- 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.
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/name_title ON /*_*/page (page_namespace,page_title);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- The index for Special:Random
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/page_random ON /*_*/page (page_random);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Questionable utility, used by ProofreadPage, possibly DynamicPageList.
|
|
|
|
|
-- ApiQueryAllPages unconditionally filters on namespace and so hopefully does
|
|
|
|
|
-- not use it.
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/page_len ON /*_*/page (page_len);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- The index for Special:Shortpages and Special:Longpages. Also SiteStats::articles()
|
|
|
|
|
-- in 'comma' counting mode, MessageCache::loadFromDB().
|
2011-11-11 16:37:38 +00:00
|
|
|
CREATE INDEX /*i*/page_redirect_namespace_len ON /*_*/page (page_is_redirect, page_namespace, page_len);
|
2004-12-19 08:00:50 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
|
|
|
|
-- Every edit of a page creates also a revision row.
|
|
|
|
|
-- This stores metadata about the revision, and a reference
|
|
|
|
|
-- to the text storage backend.
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/revision (
|
2011-11-10 21:03:23 +00:00
|
|
|
-- Unique ID to identify each revision
|
2009-01-15 06:56:58 +00:00
|
|
|
rev_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Key to page_id. This should _never_ be invalid.
|
2007-06-22 18:31:24 +00:00
|
|
|
rev_page int unsigned NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2019-11-21 20:47:13 +00:00
|
|
|
-- Key to comment.comment_id. Comment summarizing the change.
|
|
|
|
|
rev_comment_id bigint unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2019-11-21 20:47:13 +00:00
|
|
|
-- Key to actor.actor_id of the user or IP who made this edit.
|
|
|
|
|
rev_actor bigint unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2011-11-10 21:03:23 +00:00
|
|
|
-- Timestamp of when revision was created
|
2007-06-22 18:31:24 +00:00
|
|
|
rev_timestamp binary(14) NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Records whether the user marked the 'minor edit' checkbox.
|
|
|
|
|
-- Many automated edits are marked as minor.
|
2009-01-15 06:56:58 +00:00
|
|
|
rev_minor_edit tinyint unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2011-11-10 21:03:23 +00:00
|
|
|
-- Restrictions on who can access this revision
|
2009-01-15 06:56:58 +00:00
|
|
|
rev_deleted tinyint unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2007-03-08 03:20:31 +00:00
|
|
|
-- Length of this revision in bytes
|
2007-06-22 18:31:24 +00:00
|
|
|
rev_len int unsigned,
|
2007-03-08 03:20:31 +00:00
|
|
|
|
2007-03-13 15:25:59 +00:00
|
|
|
-- Key to revision.rev_id
|
|
|
|
|
-- This field is used to add support for a tree structure (The Adjacency List Model)
|
2011-10-27 18:44:10 +00:00
|
|
|
rev_parent_id int unsigned default NULL,
|
|
|
|
|
|
|
|
|
|
-- SHA-1 text content hash in base-36
|
2019-11-21 20:47:13 +00:00
|
|
|
rev_sha1 varbinary(32) NOT NULL default ''
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=1024;
|
2007-02-05 09:13:36 +00:00
|
|
|
-- In case tables are created as MyISAM, use row hints for MySQL <5.0 to avoid 4GB limit
|
2004-12-19 08:00:50 +00:00
|
|
|
|
2017-04-24 06:49:05 +00:00
|
|
|
-- 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.
|
2016-04-11 21:01:43 +00:00
|
|
|
CREATE INDEX /*i*/rev_page_id ON /*_*/revision (rev_page, rev_id);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Used by ApiQueryAllRevisions
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/rev_timestamp ON /*_*/revision (rev_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- History index
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/page_timestamp ON /*_*/revision (rev_page,rev_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
2019-11-21 20:47:13 +00:00
|
|
|
-- User contributions index
|
2020-06-02 12:23:39 +00:00
|
|
|
CREATE INDEX /*i*/rev_actor_timestamp ON /*_*/revision (rev_actor,rev_timestamp,rev_id);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Credits index. This is scanned in order to compile credits lists for pages,
|
2019-11-21 20:47:13 +00:00
|
|
|
-- in ApiQueryContributors. Also for ApiQueryRevisions if rvuser is specified.
|
|
|
|
|
CREATE INDEX /*i*/rev_page_actor_timestamp ON /*_*/revision (rev_page,rev_actor,rev_timestamp);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2004-12-19 08:00:50 +00:00
|
|
|
-- Holds text of individual page revisions.
|
|
|
|
|
--
|
2005-05-02 08:07:38 +00:00
|
|
|
-- 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.
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/text (
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Unique text storage key number.
|
|
|
|
|
-- Note that the 'oldid' parameter used in URLs does *not*
|
|
|
|
|
-- refer to this number anymore, but to rev_id.
|
2005-10-14 04:37:59 +00:00
|
|
|
--
|
2019-11-21 20:47:13 +00:00
|
|
|
-- content.content_address refers to this column
|
2009-01-15 06:56:58 +00:00
|
|
|
old_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Depending on the contents of the old_flags field, the text
|
|
|
|
|
-- may be convenient plain text, or it may be funkily encoded.
|
2006-12-21 21:40:43 +00:00
|
|
|
old_text mediumblob NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Comma-separated list of flags:
|
|
|
|
|
-- gzip: text is compressed with PHP's gzdeflate() function.
|
2014-12-15 07:42:34 +00:00
|
|
|
-- 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).
|
2005-05-02 08:07:38 +00:00
|
|
|
-- 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.
|
2014-12-15 07:42:34 +00:00
|
|
|
-- 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.
|
2009-01-15 06:56:58 +00:00
|
|
|
old_flags tinyblob NOT NULL
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=10240;
|
2007-02-05 09:13:36 +00:00
|
|
|
-- In case tables are created as MyISAM, use row hints for MySQL <5.0 to avoid 4GB limit
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
2018-03-27 01:18:19 +00:00
|
|
|
-- Archive area for deleted pages and their revisions.
|
|
|
|
|
-- These may be viewed (and restored) by admins through the Special:Undelete interface.
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/archive (
|
2012-10-28 02:23:50 +00:00
|
|
|
-- Primary key
|
|
|
|
|
ar_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2018-03-27 01:18:19 +00:00
|
|
|
|
|
|
|
|
-- Copied from page_namespace
|
2009-01-15 06:56:58 +00:00
|
|
|
ar_namespace int NOT NULL default 0,
|
2018-03-27 01:18:19 +00:00
|
|
|
-- Copied from page_title
|
2011-01-20 23:56:47 +00:00
|
|
|
ar_title varchar(255) binary NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Basic revision stuff...
|
2019-01-04 18:55:11 +00:00
|
|
|
ar_comment_id bigint unsigned NOT NULL,
|
2019-07-23 17:40:52 +00:00
|
|
|
ar_actor bigint unsigned NOT NULL,
|
2007-06-22 18:31:24 +00:00
|
|
|
ar_timestamp binary(14) NOT NULL default '',
|
2009-01-15 06:56:58 +00:00
|
|
|
ar_minor_edit tinyint NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2018-03-27 01:18:19 +00:00
|
|
|
-- Copied from rev_id.
|
2010-12-04 03:20:14 +00:00
|
|
|
--
|
2018-03-27 01:18:19 +00:00
|
|
|
-- @since 1.5 Entries from 1.4 will be NULL here. When restoring
|
|
|
|
|
-- archive rows from before 1.5, a new rev_id is created.
|
2018-01-04 19:35:13 +00:00
|
|
|
ar_rev_id int unsigned NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2018-03-27 01:18:19 +00:00
|
|
|
-- 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
|
2009-01-15 06:56:58 +00:00
|
|
|
ar_deleted tinyint unsigned NOT NULL default 0,
|
2007-03-14 22:15:04 +00:00
|
|
|
|
2018-03-27 01:18:19 +00:00
|
|
|
-- Copied from rev_len, length of this revision in bytes.
|
|
|
|
|
-- @since 1.10
|
2007-06-22 18:31:24 +00:00
|
|
|
ar_len int unsigned,
|
2007-07-23 22:37:52 +00:00
|
|
|
|
2018-03-27 01:18:19 +00:00
|
|
|
-- 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.
|
2007-08-11 14:43:47 +00:00
|
|
|
--
|
2018-03-27 01:18:19 +00:00
|
|
|
-- @since 1.11 Older entries will have NULL.
|
2007-08-11 14:43:47 +00:00
|
|
|
ar_page_id int unsigned,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2018-03-27 01:18:19 +00:00
|
|
|
-- Copied from rev_parent_id.
|
|
|
|
|
-- @since 1.13
|
2011-10-27 18:44:10 +00:00
|
|
|
ar_parent_id int unsigned default NULL,
|
|
|
|
|
|
2018-03-27 01:18:19 +00:00
|
|
|
-- Copied from rev_sha1, SHA-1 text content hash in base-36
|
|
|
|
|
-- @since 1.19
|
2019-11-21 20:47:13 +00:00
|
|
|
ar_sha1 varbinary(32) NOT NULL default ''
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2017-04-24 06:49:05 +00:00
|
|
|
-- Index for Special:Undelete to page through deleted revisions
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Index for Special:DeletedContributions
|
2017-09-12 17:12:29 +00:00
|
|
|
CREATE INDEX /*i*/ar_actor_timestamp ON /*_*/archive (ar_actor,ar_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Index for linking archive rows with tables that normally link with revision
|
|
|
|
|
-- rows, such as change_tag.
|
2018-04-27 17:11:01 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/ar_revid_uniq ON /*_*/archive (ar_rev_id);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2005-05-26 10:23:36 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
2020-02-19 16:20:11 +00:00
|
|
|
-- Blocks against user accounts, IP addresses and IP ranges.
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/ipblocks (
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Primary key, introduced for privacy.
|
2009-01-15 06:56:58 +00:00
|
|
|
ipb_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Blocked IP address in dotted-quad form or user name.
|
2006-12-21 21:40:43 +00:00
|
|
|
ipb_address tinyblob NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Blocked user ID or 0 for IP blocks.
|
2009-01-15 06:56:58 +00:00
|
|
|
ipb_user int unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2017-09-12 17:12:29 +00:00
|
|
|
-- Actor who made the block.
|
2019-07-23 17:40:52 +00:00
|
|
|
ipb_by_actor bigint unsigned NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2017-06-06 17:39:14 +00:00
|
|
|
-- Key to comment_id. Text comment made by blocker.
|
2019-01-04 18:55:11 +00:00
|
|
|
ipb_reason_id bigint unsigned NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Creation (or refresh) date in standard YMDHMS form.
|
|
|
|
|
-- IP blocks expire automatically.
|
2007-06-22 18:31:24 +00:00
|
|
|
ipb_timestamp binary(14) NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- 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.
|
2006-07-11 06:56:27 +00:00
|
|
|
ipb_auto bool NOT NULL default 0,
|
2006-07-10 06:30:03 +00:00
|
|
|
|
|
|
|
|
-- If set to 1, block applies only to logged-out users
|
2006-07-11 06:56:27 +00:00
|
|
|
ipb_anon_only bool NOT NULL default 0,
|
2006-07-10 06:30:03 +00:00
|
|
|
|
|
|
|
|
-- Block prevents account creation from matching IP addresses
|
2006-07-11 06:56:27 +00:00
|
|
|
ipb_create_account bool NOT NULL default 1,
|
2006-11-01 21:57:18 +00:00
|
|
|
|
|
|
|
|
-- Block triggers autoblocks
|
|
|
|
|
ipb_enable_autoblock bool NOT NULL default '1',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Time at which the block will expire.
|
2007-06-22 18:31:24 +00:00
|
|
|
-- May be "infinity"
|
|
|
|
|
ipb_expiry varbinary(14) NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-12-01 10:37:47 +00:00
|
|
|
-- Start and end of an address range, in hexadecimal
|
|
|
|
|
-- Size chosen to allow IPv6
|
2013-06-12 23:21:18 +00:00
|
|
|
-- FIXME: these fields were originally blank for single-IP blocks,
|
2013-08-24 15:06:25 +00:00
|
|
|
-- but now they are populated. No migration was ever done. They
|
2017-02-20 22:48:21 +00:00
|
|
|
-- should be fixed to be blank again for such blocks (T51504).
|
2006-12-21 21:40:43 +00:00
|
|
|
ipb_range_start tinyblob NOT NULL,
|
|
|
|
|
ipb_range_end tinyblob NOT NULL,
|
2007-03-14 22:00:59 +00:00
|
|
|
|
|
|
|
|
-- Flag for entries hidden from users and Sysops
|
|
|
|
|
ipb_deleted bool NOT NULL default 0,
|
2007-06-07 17:31:08 +00:00
|
|
|
|
|
|
|
|
-- Block prevents user from accessing Special:Emailuser
|
|
|
|
|
ipb_block_email bool NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2008-09-25 11:45:26 +00:00
|
|
|
-- Block allows user to edit their own talk page
|
2012-03-28 02:44:32 +00:00
|
|
|
ipb_allow_usertalk bool NOT NULL default 0,
|
|
|
|
|
|
|
|
|
|
-- 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
|
2018-06-18 14:26:20 +00:00
|
|
|
ipb_parent_block_id int default NULL,
|
|
|
|
|
|
|
|
|
|
-- Block user from editing any page on the site (other than their own user
|
|
|
|
|
-- talk page).
|
|
|
|
|
ipb_sitewide bool NOT NULL default 1
|
2005-05-02 08:40:17 +00:00
|
|
|
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2009-01-15 06:56:58 +00:00
|
|
|
-- Unique index to support "user already blocked" messages
|
|
|
|
|
-- Any new options which prevent collisions should be included
|
2020-05-04 20:16:03 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/ipb_address_unique ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2017-04-24 06:49:05 +00:00
|
|
|
-- For querying whether a logged-in user is blocked
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/ipb_user ON /*_*/ipblocks (ipb_user);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- For querying whether an IP address is in any range
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8));
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Index for Special:BlockList
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/ipb_timestamp ON /*_*/ipblocks (ipb_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Index for table pruning
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks (ipb_expiry);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Index for removing autoblocks when a parent block is removed
|
2012-03-28 02:44:32 +00:00
|
|
|
CREATE INDEX /*i*/ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id);
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Uploaded images and other files.
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/image (
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Filename.
|
|
|
|
|
-- This is also the title of the associated description page,
|
2008-12-01 17:14:30 +00:00
|
|
|
-- which will be in namespace 6 (NS_FILE).
|
2011-01-20 23:56:47 +00:00
|
|
|
img_name varchar(255) binary NOT NULL default '' PRIMARY KEY,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- File size in bytes.
|
2009-01-15 06:56:58 +00:00
|
|
|
img_size int unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- For images, size in pixels.
|
2009-01-15 06:56:58 +00:00
|
|
|
img_width int NOT NULL default 0,
|
|
|
|
|
img_height int NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2013-05-10 11:51:06 +00:00
|
|
|
-- Extracted Exif metadata stored as a serialized PHP array.
|
2005-04-21 22:10:08 +00:00
|
|
|
img_metadata mediumblob NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- For images, bits per pixel if known.
|
2009-01-15 06:56:58 +00:00
|
|
|
img_bits int NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-21 07:46:17 +00:00
|
|
|
-- Media type as defined by the MEDIATYPE_xxx constants
|
2017-02-07 18:19:10 +00:00
|
|
|
img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-21 07:46:17 +00:00
|
|
|
-- major part of a MIME media type as defined by IANA
|
2016-10-13 05:34:26 +00:00
|
|
|
-- see https://www.iana.org/assignments/media-types/
|
2014-05-25 11:23:09 +00:00
|
|
|
-- 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",
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-21 07:46:17 +00:00
|
|
|
-- minor part of a MIME media type as defined by IANA
|
|
|
|
|
-- the minor parts are not required to adher to any standard
|
|
|
|
|
-- but should be consistent throughout the database
|
2016-10-13 05:34:26 +00:00
|
|
|
-- see https://www.iana.org/assignments/media-types/
|
2010-02-23 11:24:40 +00:00
|
|
|
img_minor_mime varbinary(100) NOT NULL default "unknown",
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2019-08-27 10:32:47 +00:00
|
|
|
-- Foreign key to comment table, which contains the description field as entered by the uploader.
|
2005-05-02 08:07:38 +00:00
|
|
|
-- This is displayed in image upload history and logs.
|
2019-01-04 18:55:11 +00:00
|
|
|
img_description_id bigint unsigned NOT NULL,
|
2018-03-07 15:40:27 +00:00
|
|
|
|
2017-09-12 17:12:29 +00:00
|
|
|
-- actor_id of the uploader.
|
2019-07-23 17:40:52 +00:00
|
|
|
img_actor bigint unsigned NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Time of the upload.
|
2007-06-22 18:31:24 +00:00
|
|
|
img_timestamp varbinary(14) NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2007-07-22 14:45:12 +00:00
|
|
|
-- SHA-1 content hash in base-36
|
2009-01-15 06:56:58 +00:00
|
|
|
img_sha1 varbinary(32) NOT NULL default ''
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
2007-07-22 14:45:12 +00:00
|
|
|
|
2017-03-14 14:16:48 +00:00
|
|
|
-- Used by Special:Newimages and ApiQueryAllImages
|
2017-09-12 17:12:29 +00:00
|
|
|
CREATE INDEX /*i*/img_actor_timestamp ON /*_*/image (img_actor,img_timestamp);
|
2010-03-19 22:12:30 +00:00
|
|
|
-- Used by Special:ListFiles for sort-by-size
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/img_size ON /*_*/image (img_size);
|
2010-03-19 22:12:30 +00:00
|
|
|
-- Used by Special:Newimages and Special:ListFiles
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp);
|
2009-01-15 06:56:58 +00:00
|
|
|
-- Used in API and duplicate search
|
2012-09-26 04:05:38 +00:00
|
|
|
CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1(10));
|
2012-11-22 19:12:42 +00:00
|
|
|
-- Used to get media of one type
|
|
|
|
|
CREATE INDEX /*i*/img_media_mime ON /*_*/image (img_media_type,img_major_mime,img_minor_mime);
|
2005-05-02 08:40:17 +00:00
|
|
|
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
2005-10-14 06:27:43 +00:00
|
|
|
-- Previous revisions of uploaded files.
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Awkwardly, image rows have to be moved into
|
|
|
|
|
-- this table at re-upload time.
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/oldimage (
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Base filename: key to image.img_name
|
2011-01-20 23:56:47 +00:00
|
|
|
oi_name varchar(255) binary NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Filename of the archived file.
|
|
|
|
|
-- This is generally a timestamp and '!' prepended to the base name.
|
2011-01-20 23:56:47 +00:00
|
|
|
oi_archive_name varchar(255) binary NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Other fields as in image...
|
2007-06-22 18:31:24 +00:00
|
|
|
oi_size int unsigned NOT NULL default 0,
|
|
|
|
|
oi_width int NOT NULL default 0,
|
|
|
|
|
oi_height int NOT NULL default 0,
|
|
|
|
|
oi_bits int NOT NULL default 0,
|
2019-01-04 18:55:11 +00:00
|
|
|
oi_description_id bigint unsigned NOT NULL,
|
2019-07-23 17:40:52 +00:00
|
|
|
oi_actor bigint unsigned NOT NULL,
|
2007-06-22 18:31:24 +00:00
|
|
|
oi_timestamp binary(14) NOT NULL default '',
|
2005-04-10 18:29:30 +00:00
|
|
|
|
2007-05-31 15:26:15 +00:00
|
|
|
oi_metadata mediumblob NOT NULL,
|
2017-02-07 18:19:10 +00:00
|
|
|
oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL,
|
2014-05-25 11:23:09 +00:00
|
|
|
oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown",
|
2010-02-23 11:24:40 +00:00
|
|
|
oi_minor_mime varbinary(100) NOT NULL default "unknown",
|
2009-01-15 06:56:58 +00:00
|
|
|
oi_deleted tinyint unsigned NOT NULL default 0,
|
|
|
|
|
oi_sha1 varbinary(32) NOT NULL default ''
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2017-09-12 17:12:29 +00:00
|
|
|
CREATE INDEX /*i*/oi_actor_timestamp ON /*_*/oldimage (oi_actor,oi_timestamp);
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp);
|
2009-01-15 06:56:58 +00:00
|
|
|
-- oi_archive_name truncated to 14 to avoid key length overflow
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14));
|
2012-09-26 04:05:38 +00:00
|
|
|
CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1(10));
|
2009-01-15 06:56:58 +00:00
|
|
|
|
|
|
|
|
|
2006-06-16 01:16:45 +00:00
|
|
|
--
|
|
|
|
|
-- Record of deleted file data
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/filearchive (
|
2006-06-16 01:16:45 +00:00
|
|
|
-- Unique row id
|
2009-01-15 06:56:58 +00:00
|
|
|
fa_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2006-06-16 01:16:45 +00:00
|
|
|
-- Original base filename; key to image.img_name, page.page_title, etc
|
2011-01-20 23:56:47 +00:00
|
|
|
fa_name varchar(255) binary NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2006-06-16 01:16:45 +00:00
|
|
|
-- Filename of archived file, if an old revision
|
2011-01-20 23:56:47 +00:00
|
|
|
fa_archive_name varchar(255) binary default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2006-06-16 01:16:45 +00:00
|
|
|
-- 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.
|
2007-06-22 18:31:24 +00:00
|
|
|
fa_storage_group varbinary(16),
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2006-06-16 01:16:45 +00:00
|
|
|
-- 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.
|
2007-06-22 18:31:24 +00:00
|
|
|
fa_storage_key varbinary(64) default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2006-06-16 01:16:45 +00:00
|
|
|
-- Deletion information, if this file is deleted.
|
|
|
|
|
fa_deleted_user int,
|
2007-06-22 18:31:24 +00:00
|
|
|
fa_deleted_timestamp binary(14) default '',
|
2019-01-04 18:55:11 +00:00
|
|
|
fa_deleted_reason_id bigint unsigned NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2006-06-16 01:16:45 +00:00
|
|
|
-- Duped fields from image
|
2009-01-15 06:56:58 +00:00
|
|
|
fa_size int unsigned default 0,
|
|
|
|
|
fa_width int default 0,
|
|
|
|
|
fa_height int default 0,
|
2006-06-16 01:16:45 +00:00
|
|
|
fa_metadata mediumblob,
|
2009-01-15 06:56:58 +00:00
|
|
|
fa_bits int default 0,
|
2017-02-07 18:19:10 +00:00
|
|
|
fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL,
|
2014-05-25 11:23:09 +00:00
|
|
|
fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") default "unknown",
|
2010-02-23 11:24:40 +00:00
|
|
|
fa_minor_mime varbinary(100) default "unknown",
|
2019-01-04 18:55:11 +00:00
|
|
|
fa_description_id bigint unsigned NOT NULL,
|
2019-07-23 17:40:52 +00:00
|
|
|
fa_actor bigint unsigned NOT NULL,
|
2007-06-22 18:31:24 +00:00
|
|
|
fa_timestamp binary(14) default '',
|
2007-03-14 22:00:59 +00:00
|
|
|
|
|
|
|
|
-- Visibility of deleted revisions, bitfield
|
2012-10-14 18:58:25 +00:00
|
|
|
fa_deleted tinyint unsigned NOT NULL default 0,
|
|
|
|
|
|
|
|
|
|
-- sha1 hash of file content
|
|
|
|
|
fa_sha1 varbinary(32) NOT NULL default ''
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2005-05-02 08:07:38 +00:00
|
|
|
|
2009-01-15 06:56:58 +00:00
|
|
|
-- pick out by image name
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp);
|
2009-01-15 06:56:58 +00:00
|
|
|
-- pick out dupe files
|
2009-01-19 14:12:59 +00:00
|
|
|
CREATE INDEX /*i*/fa_storage_group ON /*_*/filearchive (fa_storage_group, fa_storage_key);
|
2009-01-15 06:56:58 +00:00
|
|
|
-- sort by deletion time
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp);
|
2009-01-15 06:56:58 +00:00
|
|
|
-- sort by uploader
|
2017-09-12 17:12:29 +00:00
|
|
|
CREATE INDEX /*i*/fa_actor_timestamp ON /*_*/filearchive (fa_actor,fa_timestamp);
|
2012-10-14 18:58:25 +00:00
|
|
|
-- find file by sha1, 10 bytes will be enough for hashes to be indexed
|
|
|
|
|
CREATE INDEX /*i*/fa_sha1 ON /*_*/filearchive (fa_sha1(10));
|
2009-01-15 06:56:58 +00:00
|
|
|
|
|
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
|
|
|
|
-- Primarily a summary table for Special:Recentchanges,
|
|
|
|
|
-- this table contains some additional info on edits from
|
2005-10-14 06:27:43 +00:00
|
|
|
-- the last few days, see Article::editUpdates()
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/recentchanges (
|
|
|
|
|
rc_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2007-06-22 18:31:24 +00:00
|
|
|
rc_timestamp varbinary(14) NOT NULL default '',
|
2011-10-30 00:36:30 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- As in revision
|
2019-07-23 17:40:52 +00:00
|
|
|
rc_actor bigint unsigned NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- When pages are renamed, their RC entries do _not_ change.
|
2009-01-15 06:56:58 +00:00
|
|
|
rc_namespace int NOT NULL default 0,
|
2011-01-20 23:56:47 +00:00
|
|
|
rc_title varchar(255) binary NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- as in revision...
|
2019-01-04 18:55:11 +00:00
|
|
|
rc_comment_id bigint unsigned NOT NULL,
|
2009-01-15 06:56:58 +00:00
|
|
|
rc_minor tinyint unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Edits by user accounts with the 'bot' rights key are
|
|
|
|
|
-- marked with a 1 here, and will be hidden from the
|
|
|
|
|
-- default view.
|
2009-01-15 06:56:58 +00:00
|
|
|
rc_bot tinyint unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2011-10-29 09:53:55 +00:00
|
|
|
-- Set if this change corresponds to a page creation
|
2009-01-15 06:56:58 +00:00
|
|
|
rc_new tinyint unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- 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.
|
2009-01-15 06:56:58 +00:00
|
|
|
rc_cur_id int unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- rev_id of the given revision
|
2009-01-15 06:56:58 +00:00
|
|
|
rc_this_oldid int unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- rev_id of the prior revision, for generating diff links.
|
2009-01-15 06:56:58 +00:00
|
|
|
rc_last_oldid int unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2013-05-17 14:59:26 +00:00
|
|
|
-- The type of change entry (RC_EDIT,RC_NEW,RC_LOG,RC_EXTERNAL)
|
2009-01-15 06:56:58 +00:00
|
|
|
rc_type tinyint unsigned NOT NULL default 0,
|
2011-10-29 09:53:55 +00:00
|
|
|
|
2013-10-25 20:10:42 +00:00
|
|
|
-- 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 '',
|
|
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- 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.
|
2009-01-15 06:56:58 +00:00
|
|
|
rc_patrolled tinyint unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Recorded IP address the edit was made from, if the
|
|
|
|
|
-- $wgPutIPinRC option is enabled.
|
2007-06-22 18:31:24 +00:00
|
|
|
rc_ip varbinary(40) NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2006-12-09 11:36:35 +00:00
|
|
|
-- Text length in characters before
|
|
|
|
|
-- and after the edit
|
2007-06-22 18:31:24 +00:00
|
|
|
rc_old_len int,
|
|
|
|
|
rc_new_len int,
|
2006-12-09 11:36:35 +00:00
|
|
|
|
2008-08-29 12:11:45 +00:00
|
|
|
-- Visibility of recent changes items, bitfield
|
2009-01-15 06:56:58 +00:00
|
|
|
rc_deleted tinyint unsigned NOT NULL default 0,
|
2007-03-14 22:00:59 +00:00
|
|
|
|
2012-10-28 02:23:50 +00:00
|
|
|
-- Value corresponding to log_id, specific log entries
|
2009-01-15 06:56:58 +00:00
|
|
|
rc_logid int unsigned NOT NULL default 0,
|
2007-03-14 22:00:59 +00:00
|
|
|
-- Store log type info here, or null
|
2007-06-22 20:11:42 +00:00
|
|
|
rc_log_type varbinary(255) NULL default NULL,
|
2007-03-14 22:00:59 +00:00
|
|
|
-- Store log action or null
|
2007-06-22 20:11:42 +00:00
|
|
|
rc_log_action varbinary(255) NULL default NULL,
|
2007-03-14 22:00:59 +00:00
|
|
|
-- Log params
|
2009-01-15 06:56:58 +00:00
|
|
|
rc_params blob NULL
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2017-04-24 06:49:05 +00:00
|
|
|
-- Special:Recentchanges
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/rc_timestamp ON /*_*/recentchanges (rc_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Special:Watchlist
|
2018-03-22 19:46:49 +00:00
|
|
|
CREATE INDEX /*i*/rc_namespace_title_timestamp ON /*_*/recentchanges (rc_namespace, rc_title, rc_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Special:Recentchangeslinked when finding changes in pages linked from a page
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/rc_cur_id ON /*_*/recentchanges (rc_cur_id);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Special:Newpages
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Blank unless $wgPutIPinRC=true (false at WMF), possibly used by extensions,
|
|
|
|
|
-- but mostly replaced by CheckUser.
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/rc_ip ON /*_*/recentchanges (rc_ip);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Probably intended for Special:NewPages namespace filter
|
2017-09-12 17:12:29 +00:00
|
|
|
CREATE INDEX /*i*/rc_ns_actor ON /*_*/recentchanges (rc_namespace, rc_actor);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- SiteStats active user count, Special:ActiveUsers, Special:NewPages user filter
|
2017-09-12 17:12:29 +00:00
|
|
|
CREATE INDEX /*i*/rc_actor ON /*_*/recentchanges (rc_actor, rc_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- ApiQueryRecentChanges (T140108)
|
2016-07-14 16:01:04 +00:00
|
|
|
CREATE INDEX /*i*/rc_name_type_patrolled_timestamp ON /*_*/recentchanges (rc_namespace, rc_type, rc_patrolled, rc_timestamp);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2018-08-02 19:12:07 +00:00
|
|
|
-- Article.php and friends (T139012)
|
|
|
|
|
CREATE INDEX /*i*/rc_this_oldid ON /*_*/recentchanges (rc_this_oldid);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- When using the default MySQL search backend, page titles
|
|
|
|
|
-- and text are munged to strip markup, do Unicode case folding,
|
|
|
|
|
-- and prepare the result for MySQL's fulltext index.
|
|
|
|
|
--
|
|
|
|
|
-- This table must be MyISAM; InnoDB does not support the needed
|
|
|
|
|
-- fulltext index.
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/searchindex (
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Key to page_id
|
2007-06-22 18:31:24 +00:00
|
|
|
si_page int unsigned NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Munged version of title
|
2011-01-20 23:56:47 +00:00
|
|
|
si_title varchar(255) NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Munged version of body text
|
2009-01-15 06:56:58 +00:00
|
|
|
si_text mediumtext NOT NULL
|
2013-09-26 05:38:02 +00:00
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2013-04-29 18:19:13 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/si_page ON /*_*/searchindex (si_page);
|
|
|
|
|
CREATE FULLTEXT INDEX /*i*/si_title ON /*_*/searchindex (si_title);
|
|
|
|
|
CREATE FULLTEXT INDEX /*i*/si_text ON /*_*/searchindex (si_text);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
|
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
2004-05-09 05:12:55 +00:00
|
|
|
-- For a few generic cache operations if not using Memcached
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/objectcache (
|
2009-01-19 14:12:59 +00:00
|
|
|
keyname varbinary(255) NOT NULL default '' PRIMARY KEY,
|
2004-05-09 05:12:55 +00:00
|
|
|
value mediumblob,
|
2009-01-15 06:56:58 +00:00
|
|
|
exptime datetime
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2009-01-19 14:12:59 +00:00
|
|
|
CREATE INDEX /*i*/exptime ON /*_*/objectcache (exptime);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2006-07-10 06:30:03 +00:00
|
|
|
-- vim: sw=2 sts=2 et
|