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.
|
|
|
|
|
--
|
|
|
|
|
-- *NOT* intended to be an accurate copy of COUNT(*) WHERE rev_user=user_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.
|
|
|
|
|
--
|
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
|
|
|
|
2004-08-09 05:38:11 +00:00
|
|
|
|
2017-09-12 17:12:29 +00:00
|
|
|
--
|
|
|
|
|
-- 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.
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE /*_*/actor (
|
|
|
|
|
-- Unique ID to identify each actor
|
|
|
|
|
actor_id bigint unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
|
|
|
|
|
|
|
|
-- Key to user.user_id, or NULL for anonymous edits.
|
|
|
|
|
actor_user int unsigned,
|
|
|
|
|
|
|
|
|
|
-- Text username or IP address
|
|
|
|
|
actor_name varchar(255) binary NOT NULL
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
|
|
|
|
-- User IDs and names must be unique.
|
|
|
|
|
CREATE UNIQUE INDEX /*i*/actor_user ON /*_*/actor (actor_user);
|
|
|
|
|
CREATE UNIQUE INDEX /*i*/actor_name ON /*_*/actor (actor_name);
|
|
|
|
|
|
|
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
|
|
|
|
-- 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.
|
|
|
|
|
--
|
2005-06-09 09:49:10 +00:00
|
|
|
-- This table replaces the old user_rights field which used a
|
|
|
|
|
-- comma-separated blob.
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/user_groups (
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Key to user_id
|
2009-01-15 06:56:58 +00:00
|
|
|
ug_user int unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-06-09 09:49:10 +00:00
|
|
|
-- 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.
|
User group memberships that expire
This patch adds an ug_expiry column to the user_groups table, a timestamp
giving a date when the user group expires. A new UserGroupMembership class,
based on the Block class, manages entries in this table.
When the expiry date passes, the row in user_groups is ignored, and will
eventually be purged from the DB when UserGroupMembership::insert is next
called. Old, expired user group memberships are not kept; instead, the log
entries are available to find the history of these memberships, similar
to the way it has always worked for blocks and protections.
Anyone getting user group info through the User object will get correct
information. However, code that reads the user_groups table directly will
now need to skip over rows with ug_expiry < wfTimestampNow(). See
UsersPager for an example of how to do this.
NULL is used to represent infinite (no) expiry, rather than a string
'infinity' or similar (except in the API). This allows existing user group
assignments and log entries, which are all infinite in duration, to be
treated the same as new, infinite-length memberships, without special
casing everything.
The whole thing is behind the temporary feature flag
$wgDisableUserGroupExpiry, in accordance with the WMF schema change policy.
The opportunity has been taken to refactor some static user-group-related
functions out of User into UserGroupMembership, and also to add a primary
key (ug_user, ug_group) to the user_groups table.
There are a few breaking changes:
- UserRightsProxy-like objects are now required to have a
getGroupMemberships() function.
- $user->mGroups (on a User object) is no longer present.
- Some protected functions in UsersPager are altered or removed.
- The UsersPagerDoBatchLookups hook (unused in any Wikimedia Git-hosted
extension) has a change of parameter.
Bug: T12493
Depends-On: Ia9616e1e35184fed9058d2d39afbe1038f56d7fa
Depends-On: I86eb1d5619347ce54a5f33a591417742ebe5d6f8
Change-Id: I93c955dc7a970f78e32aa503c01c67da30971d1a
2017-01-12 06:07:56 +00:00
|
|
|
ug_group varbinary(255) NOT NULL default '',
|
|
|
|
|
|
|
|
|
|
-- Time at which the user group membership will expire. Set to
|
|
|
|
|
-- NULL for a non-expiring (infinite) membership.
|
|
|
|
|
ug_expiry varbinary(14) NULL default NULL,
|
|
|
|
|
|
|
|
|
|
PRIMARY KEY (ug_user, ug_group)
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2004-08-24 20:41:07 +00:00
|
|
|
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/ug_group ON /*_*/user_groups (ug_group);
|
User group memberships that expire
This patch adds an ug_expiry column to the user_groups table, a timestamp
giving a date when the user group expires. A new UserGroupMembership class,
based on the Block class, manages entries in this table.
When the expiry date passes, the row in user_groups is ignored, and will
eventually be purged from the DB when UserGroupMembership::insert is next
called. Old, expired user group memberships are not kept; instead, the log
entries are available to find the history of these memberships, similar
to the way it has always worked for blocks and protections.
Anyone getting user group info through the User object will get correct
information. However, code that reads the user_groups table directly will
now need to skip over rows with ug_expiry < wfTimestampNow(). See
UsersPager for an example of how to do this.
NULL is used to represent infinite (no) expiry, rather than a string
'infinity' or similar (except in the API). This allows existing user group
assignments and log entries, which are all infinite in duration, to be
treated the same as new, infinite-length memberships, without special
casing everything.
The whole thing is behind the temporary feature flag
$wgDisableUserGroupExpiry, in accordance with the WMF schema change policy.
The opportunity has been taken to refactor some static user-group-related
functions out of User into UserGroupMembership, and also to add a primary
key (ug_user, ug_group) to the user_groups table.
There are a few breaking changes:
- UserRightsProxy-like objects are now required to have a
getGroupMemberships() function.
- $user->mGroups (on a User object) is no longer present.
- Some protected functions in UsersPager are altered or removed.
- The UsersPagerDoBatchLookups hook (unused in any Wikimedia Git-hosted
extension) has a change of parameter.
Bug: T12493
Depends-On: Ia9616e1e35184fed9058d2d39afbe1038f56d7fa
Depends-On: I86eb1d5619347ce54a5f33a591417742ebe5d6f8
Change-Id: I93c955dc7a970f78e32aa503c01c67da30971d1a
2017-01-12 06:07:56 +00:00
|
|
|
CREATE INDEX /*i*/ug_expiry ON /*_*/user_groups (ug_expiry);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2011-07-23 08:15:11 +00:00
|
|
|
-- Stores the groups the user has once belonged to.
|
2012-02-16 21:32:53 +00:00
|
|
|
-- The user may still belong to these groups (check user_groups).
|
2012-02-15 22:42:09 +00:00
|
|
|
-- Users are not autopromoted to groups from which they were removed.
|
2011-06-25 02:52:30 +00:00
|
|
|
CREATE TABLE /*_*/user_former_groups (
|
|
|
|
|
-- Key to user_id
|
|
|
|
|
ufg_user int unsigned NOT NULL default 0,
|
2017-08-04 12:43:50 +00:00
|
|
|
ufg_group varbinary(255) NOT NULL default '',
|
|
|
|
|
PRIMARY KEY (ufg_user,ufg_group)
|
2011-06-25 02:52:30 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
2009-04-27 17:15:01 +00:00
|
|
|
--
|
2005-06-25 13:47:18 +00:00
|
|
|
-- Stores notifications of user talk page changes, for the display
|
|
|
|
|
-- of the "you have new messages" box
|
2009-04-27 17:15:01 +00:00
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/user_newtalk (
|
2005-10-14 06:27:43 +00:00
|
|
|
-- Key to user.user_id
|
2015-02-15 18:29:38 +00:00
|
|
|
user_id int unsigned NOT NULL default 0,
|
2007-03-17 19:10:58 +00:00
|
|
|
-- If the user is an anonymous user their IP address is stored here
|
2005-10-14 06:27:43 +00:00
|
|
|
-- since the user_id of 0 is ambiguous
|
2007-06-22 18:31:24 +00:00
|
|
|
user_ip varbinary(40) NOT NULL default '',
|
2008-04-17 21:17:28 +00:00
|
|
|
-- The highest timestamp of revisions of the talk page viewed
|
|
|
|
|
-- by this user
|
2011-03-03 06:28:43 +00:00
|
|
|
user_last_timestamp varbinary(14) NULL default NULL
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2009-01-15 06:56:58 +00:00
|
|
|
-- Indexes renamed for SQLite in 1.14
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/un_user_id ON /*_*/user_newtalk (user_id);
|
|
|
|
|
CREATE INDEX /*i*/un_user_ip ON /*_*/user_newtalk (user_ip);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
|
2009-04-27 17:15:01 +00:00
|
|
|
--
|
|
|
|
|
-- 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 defauls
|
|
|
|
|
-- 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 sane table structure.
|
|
|
|
|
--
|
2009-05-19 20:55:29 +00:00
|
|
|
CREATE TABLE /*_*/user_properties (
|
2009-04-27 17:15:01 +00:00
|
|
|
-- Foreign key to user.user_id
|
2017-04-26 16:08:51 +00:00
|
|
|
up_user int unsigned NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2009-04-27 17:15:01 +00:00
|
|
|
-- Name of the option being saved. This is indexed for bulk lookup.
|
2011-05-03 21:08:44 +00:00
|
|
|
up_property varbinary(255) NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2009-04-27 17:15:01 +00:00
|
|
|
-- Property value as a string.
|
2017-08-04 12:43:50 +00:00
|
|
|
up_value blob,
|
|
|
|
|
PRIMARY KEY (up_user,up_property)
|
2009-04-27 17:15:01 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
2009-05-19 20:55:29 +00:00
|
|
|
CREATE INDEX /*i*/user_properties_property ON /*_*/user_properties (up_property);
|
2009-04-27 17:15:01 +00:00
|
|
|
|
2016-02-01 20:44:03 +00:00
|
|
|
--
|
|
|
|
|
-- This table contains a user's bot passwords: passwords that allow access to
|
|
|
|
|
-- the account via the API with limited rights.
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE /*_*/bot_passwords (
|
|
|
|
|
-- User ID obtained from CentralIdLookup.
|
2017-04-26 16:08:51 +00:00
|
|
|
bp_user int unsigned NOT NULL,
|
2016-02-01 20:44:03 +00:00
|
|
|
|
|
|
|
|
-- Application identifier
|
|
|
|
|
bp_app_id varbinary(32) NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- Password hashes, like user.user_password
|
|
|
|
|
bp_password tinyblob NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- Like user.user_token
|
|
|
|
|
bp_token binary(32) NOT NULL default '',
|
|
|
|
|
|
|
|
|
|
-- JSON blob for MWRestrictions
|
|
|
|
|
bp_restrictions blob NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- Grants allowed to the account when authenticated with this bot-password
|
|
|
|
|
bp_grants blob NOT NULL,
|
|
|
|
|
|
|
|
|
|
PRIMARY KEY ( bp_user, bp_app_id )
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
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.
|
2006-12-21 21:40:43 +00:00
|
|
|
page_restrictions tinyblob NOT 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
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Key to text.old_id, where the actual bulk text is stored.
|
|
|
|
|
-- It's possible for multiple revisions to use the same text,
|
|
|
|
|
-- for instance revisions where only metadata is altered
|
|
|
|
|
-- or a rollback to a previous version.
|
2018-03-12 16:21:02 +00:00
|
|
|
rev_text_id int unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2017-06-06 17:39:14 +00:00
|
|
|
-- Text comment summarizing the change. Deprecated in favor of
|
|
|
|
|
-- revision_comment_temp.revcomment_comment_id.
|
|
|
|
|
rev_comment varbinary(767) NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-10-14 06:27:43 +00:00
|
|
|
-- Key to user.user_id of the user who made this edit.
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Stores 0 for anonymous edits and for some mass imports.
|
2017-09-12 17:12:29 +00:00
|
|
|
-- Deprecated in favor of revision_actor_temp.revactor_actor.
|
2009-01-15 06:56:58 +00:00
|
|
|
rev_user int unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Text username or IP address of the editor.
|
2017-09-12 17:12:29 +00:00
|
|
|
-- Deprecated in favor of revision_actor_temp.revactor_actor.
|
2011-01-20 23:56:47 +00:00
|
|
|
rev_user_text varchar(255) binary NOT NULL default '',
|
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
|
2012-03-06 17:35:24 +00:00
|
|
|
rev_sha1 varbinary(32) NOT NULL default '',
|
|
|
|
|
|
2012-05-13 22:02:29 +00:00
|
|
|
-- content model, see CONTENT_MODEL_XXX constants
|
2012-10-10 09:40:22 +00:00
|
|
|
rev_content_model varbinary(32) DEFAULT NULL,
|
2012-03-06 17:35:24 +00:00
|
|
|
|
2012-05-13 22:02:29 +00:00
|
|
|
-- content format, see CONTENT_FORMAT_XXX constants
|
2012-10-10 09:40:22 +00:00
|
|
|
rev_content_format varbinary(64) DEFAULT NULL
|
2005-05-02 08:40:17 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
-- Logged-in user contributions index
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/user_timestamp ON /*_*/revision (rev_user,rev_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Anonymous user countributions index
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/usertext_timestamp ON /*_*/revision (rev_user_text,rev_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Credits index. This is scanned in order to compile credits lists for pages,
|
|
|
|
|
-- in ApiQueryContributors. Also for ApiQueryRevisions if rvuser is specified
|
|
|
|
|
-- and is a logged-in user.
|
2012-03-24 21:14:09 +00:00
|
|
|
CREATE INDEX /*i*/page_user_timestamp ON /*_*/revision (rev_page,rev_user,rev_timestamp);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2017-06-06 17:39:14 +00:00
|
|
|
--
|
|
|
|
|
-- Temporary table to avoid blocking on an alter of revision.
|
|
|
|
|
--
|
|
|
|
|
-- On large wikis like the English Wikipedia, altering the revision table is a
|
|
|
|
|
-- months-long process. This table is being created to avoid such an alter, and
|
|
|
|
|
-- will be merged back into revision in the future.
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE /*_*/revision_comment_temp (
|
|
|
|
|
-- Key to rev_id
|
|
|
|
|
revcomment_rev int unsigned NOT NULL,
|
|
|
|
|
-- Key to comment_id
|
|
|
|
|
revcomment_comment_id bigint unsigned NOT NULL,
|
|
|
|
|
PRIMARY KEY (revcomment_rev, revcomment_comment_id)
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
-- Ensure uniqueness
|
|
|
|
|
CREATE UNIQUE INDEX /*i*/revcomment_rev ON /*_*/revision_comment_temp (revcomment_rev);
|
|
|
|
|
|
2017-09-12 17:12:29 +00:00
|
|
|
--
|
|
|
|
|
-- Temporary table to avoid blocking on an alter of revision.
|
|
|
|
|
--
|
|
|
|
|
-- On large wikis like the English Wikipedia, altering the revision table is a
|
|
|
|
|
-- months-long process. This table is being created to avoid such an alter, and
|
|
|
|
|
-- will be merged back into revision in the future.
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE /*_*/revision_actor_temp (
|
|
|
|
|
-- Key to rev_id
|
|
|
|
|
revactor_rev int unsigned NOT NULL,
|
|
|
|
|
-- Key to actor_id
|
|
|
|
|
revactor_actor bigint unsigned NOT NULL,
|
|
|
|
|
-- Copy fields from revision for indexes
|
|
|
|
|
revactor_timestamp binary(14) NOT NULL default '',
|
|
|
|
|
revactor_page int unsigned NOT NULL,
|
|
|
|
|
PRIMARY KEY (revactor_rev, revactor_actor)
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
-- Ensure uniqueness
|
|
|
|
|
CREATE UNIQUE INDEX /*i*/revactor_rev ON /*_*/revision_actor_temp (revactor_rev);
|
|
|
|
|
-- Match future indexes on revision
|
|
|
|
|
CREATE INDEX /*i*/actor_timestamp ON /*_*/revision_actor_temp (revactor_actor,revactor_timestamp);
|
|
|
|
|
CREATE INDEX /*i*/page_actor_timestamp ON /*_*/revision_actor_temp (revactor_page,revactor_actor,revactor_timestamp);
|
|
|
|
|
|
2017-08-09 21:34:09 +00:00
|
|
|
--
|
|
|
|
|
-- 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.
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE /*_*/ip_changes (
|
|
|
|
|
-- Foreign key to the revision table, also serves as the unique primary key
|
|
|
|
|
ipc_rev_id int unsigned NOT NULL PRIMARY KEY DEFAULT '0',
|
|
|
|
|
|
|
|
|
|
-- The timestamp of the revision
|
|
|
|
|
ipc_rev_timestamp binary(14) NOT NULL DEFAULT '',
|
|
|
|
|
|
|
|
|
|
-- Hex representation of the IP address, as returned by IP::toHex()
|
|
|
|
|
-- For IPv4 it will resemble: ABCD1234
|
|
|
|
|
-- For IPv6: v6-ABCD1234000000000000000000000000
|
|
|
|
|
-- BETWEEN is then used to identify revisions within a given range
|
|
|
|
|
ipc_hex varbinary(35) NOT NULL DEFAULT ''
|
|
|
|
|
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
|
|
|
|
CREATE INDEX /*i*/ipc_rev_timestamp ON /*_*/ip_changes (ipc_rev_timestamp);
|
|
|
|
|
CREATE INDEX /*i*/ipc_hex_time ON /*_*/ip_changes (ipc_hex,ipc_rev_timestamp);
|
|
|
|
|
|
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
|
|
|
--
|
|
|
|
|
-- revision.rev_text_id is a key 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
|
|
|
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2017-06-06 17:39:14 +00:00
|
|
|
--
|
|
|
|
|
-- 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.
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE /*_*/comment (
|
|
|
|
|
-- Unique ID to identify each comment
|
|
|
|
|
comment_id bigint unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
|
|
|
|
|
|
|
|
-- Hash of comment_text and comment_data, for deduplication
|
|
|
|
|
comment_hash INT NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- Text comment summarizing the change.
|
|
|
|
|
-- This text is shown in the history and other changes lists,
|
|
|
|
|
-- rendered in a subset of wiki markup by Linker::formatComment()
|
|
|
|
|
-- Size limits are enforced at the application level, and should
|
|
|
|
|
-- take care to crop UTF-8 strings appropriately.
|
|
|
|
|
comment_text BLOB NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- 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.
|
|
|
|
|
comment_data BLOB
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
-- Index used for deduplication.
|
2017-08-30 15:33:14 +00:00
|
|
|
CREATE INDEX /*i*/comment_hash ON /*_*/comment (comment_hash);
|
2017-06-06 17:39:14 +00:00
|
|
|
|
|
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
|
|
|
|
-- Holding area for deleted articles, which may be viewed
|
|
|
|
|
-- or restored by admins through the Special:Undelete interface.
|
|
|
|
|
-- The fields generally correspond to the page, revision, and text
|
|
|
|
|
-- fields, with several caveats.
|
|
|
|
|
--
|
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,
|
2009-01-15 06:56:58 +00:00
|
|
|
ar_namespace int NOT NULL default 0,
|
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
|
|
|
-- Newly deleted pages will not store text in this table,
|
|
|
|
|
-- but will reference the separately existing text rows.
|
|
|
|
|
-- This field is retained for backwards compatibility,
|
|
|
|
|
-- so old archived pages will remain accessible after
|
|
|
|
|
-- upgrading from 1.4 to 1.5.
|
2005-06-25 09:00:49 +00:00
|
|
|
-- Text may be gzipped or otherwise funky.
|
2006-12-21 21:40:43 +00:00
|
|
|
ar_text mediumblob NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Basic revision stuff...
|
2017-06-06 17:39:14 +00:00
|
|
|
ar_comment varbinary(767) NOT NULL default '', -- Deprecated in favor of ar_comment_id
|
|
|
|
|
ar_comment_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that ar_comment should be used)
|
2017-09-12 17:12:29 +00:00
|
|
|
ar_user int unsigned NOT NULL default 0, -- Deprecated in favor of ar_actor
|
|
|
|
|
ar_user_text varchar(255) binary NOT NULL DEFAULT '', -- Deprecated in favor of ar_actor
|
|
|
|
|
ar_actor bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that ar_user/ar_user_text should be used)
|
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
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- See ar_text note.
|
2006-12-21 21:40:43 +00:00
|
|
|
ar_flags tinyblob NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- When revisions are deleted, their unique rev_id is stored
|
|
|
|
|
-- here so it can be retained after undeletion. This is necessary
|
|
|
|
|
-- to retain permalinks to given revisions after accidental delete
|
|
|
|
|
-- cycles or messy operations like history merges.
|
2010-12-04 03:20:14 +00:00
|
|
|
--
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Old entries from 1.4 will be NULL here, and a new rev_id will
|
|
|
|
|
-- be created on undeletion for those revisions.
|
2007-06-22 18:31:24 +00:00
|
|
|
ar_rev_id int unsigned,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- For newly deleted revisions, this is the text.old_id key to the
|
|
|
|
|
-- actual stored text. To avoid breaking the block-compression scheme
|
|
|
|
|
-- and otherwise making storage changes harder, the actual text is
|
|
|
|
|
-- *not* deleted from the text table, merely hidden by removal of the
|
|
|
|
|
-- page and revision entries.
|
|
|
|
|
--
|
|
|
|
|
-- Old entries deleted under 1.2-1.4 will have NULL here, and their
|
|
|
|
|
-- ar_text and ar_flags fields will be used to create a new text
|
|
|
|
|
-- row upon undeletion.
|
2007-06-22 18:31:24 +00:00
|
|
|
ar_text_id int unsigned,
|
2007-03-14 22:00:59 +00:00
|
|
|
|
|
|
|
|
-- rev_deleted for archives
|
2009-01-15 06:56:58 +00:00
|
|
|
ar_deleted tinyint unsigned NOT NULL default 0,
|
2007-03-14 22:15:04 +00:00
|
|
|
|
|
|
|
|
-- Length of this revision in bytes
|
2007-06-22 18:31:24 +00:00
|
|
|
ar_len int unsigned,
|
2007-07-23 22:37:52 +00:00
|
|
|
|
2010-12-04 03:20:14 +00:00
|
|
|
-- Reference to page_id. Useful for sysadmin fixing of large pages
|
2007-08-11 14:43:47 +00:00
|
|
|
-- merged together in the archives, or for cleanly restoring a page
|
|
|
|
|
-- at its original ID number if possible.
|
|
|
|
|
--
|
|
|
|
|
-- Will be NULL for pages deleted prior to 1.11.
|
|
|
|
|
ar_page_id int unsigned,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2008-04-11 22:57:01 +00:00
|
|
|
-- Original previous revision
|
2011-10-27 18:44:10 +00:00
|
|
|
ar_parent_id int unsigned default NULL,
|
|
|
|
|
|
|
|
|
|
-- SHA-1 text content hash in base-36
|
2012-03-06 17:35:24 +00:00
|
|
|
ar_sha1 varbinary(32) NOT NULL default '',
|
|
|
|
|
|
2012-05-13 22:02:29 +00:00
|
|
|
-- content model, see CONTENT_MODEL_XXX constants
|
2012-10-10 09:40:22 +00:00
|
|
|
ar_content_model varbinary(32) DEFAULT NULL,
|
2012-03-06 17:35:24 +00:00
|
|
|
|
2012-06-03 17:46:07 +00:00
|
|
|
-- content format, see CONTENT_FORMAT_XXX constants
|
2012-10-10 09:40:22 +00:00
|
|
|
ar_content_format varbinary(64) DEFAULT 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
|
|
|
-- 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
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp);
|
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.
|
2011-01-06 19:27:17 +00:00
|
|
|
CREATE INDEX /*i*/ar_revid ON /*_*/archive (ar_rev_id);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2017-09-18 15:00:26 +00:00
|
|
|
--
|
|
|
|
|
-- 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.
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE /*_*/slots (
|
|
|
|
|
|
|
|
|
|
-- reference to rev_id
|
|
|
|
|
slot_revision_id bigint unsigned NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- reference to role_id
|
|
|
|
|
slot_role_id smallint unsigned NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- reference to content_id
|
|
|
|
|
slot_content_id bigint unsigned NOT NULL,
|
|
|
|
|
|
2018-03-06 14:42:43 +00:00
|
|
|
-- 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.
|
|
|
|
|
slot_origin bigint unsigned NOT NULL,
|
2017-09-18 15:00:26 +00:00
|
|
|
|
|
|
|
|
PRIMARY KEY ( slot_revision_id, slot_role_id )
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
|
|
|
|
-- Index for finding revisions that modified a specific slot
|
2018-03-06 14:42:43 +00:00
|
|
|
CREATE INDEX /*i*/slot_revision_origin_role ON /*_*/slots (slot_revision_id, slot_origin, slot_role_id);
|
2017-09-18 15:00:26 +00:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- 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.
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE /*_*/content (
|
|
|
|
|
|
|
|
|
|
-- ID of the content object
|
|
|
|
|
content_id bigint unsigned PRIMARY KEY AUTO_INCREMENT,
|
|
|
|
|
|
|
|
|
|
-- Nominal size of the content object (not necessarily of the serialized blob)
|
|
|
|
|
content_size int unsigned NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- Nominal hash of the content object (not necessarily of the serialized blob)
|
|
|
|
|
content_sha1 varbinary(32) NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- reference to model_id
|
|
|
|
|
content_model smallint unsigned NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- URL-like address of the content blob
|
|
|
|
|
content_address varbinary(255) NOT NULL
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Normalization table for role names
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE /*_*/slot_roles (
|
|
|
|
|
role_id smallint PRIMARY KEY AUTO_INCREMENT,
|
|
|
|
|
role_name varbinary(64) NOT NULL
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
|
|
|
|
-- Index for looking of the internal ID of for a name
|
|
|
|
|
CREATE UNIQUE INDEX /*i*/role_name ON /*_*/slot_roles (role_name);
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Normalization table for content model names
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE /*_*/content_models (
|
|
|
|
|
model_id smallint PRIMARY KEY AUTO_INCREMENT,
|
|
|
|
|
model_name varbinary(64) NOT NULL
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
|
|
|
|
-- Index for looking of the internal ID of for a name
|
|
|
|
|
CREATE UNIQUE INDEX /*i*/model_name ON /*_*/content_models (model_name);
|
2005-05-26 10:23:36 +00:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Track page-to-page hyperlinks within the wiki.
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/pagelinks (
|
2005-05-26 10:23:36 +00:00
|
|
|
-- Key to the page_id of the page containing the link.
|
2009-01-15 06:56:58 +00:00
|
|
|
pl_from int unsigned NOT NULL default 0,
|
2014-03-06 23:01:35 +00:00
|
|
|
-- Namespace for this page
|
|
|
|
|
pl_from_namespace int NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-26 10:23:36 +00:00
|
|
|
-- 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.
|
2009-01-15 06:56:58 +00:00
|
|
|
pl_namespace int NOT NULL default 0,
|
2017-08-04 12:43:50 +00:00
|
|
|
pl_title varchar(255) binary NOT NULL default '',
|
|
|
|
|
PRIMARY KEY (pl_from,pl_namespace,pl_title)
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2005-05-26 10:23:36 +00:00
|
|
|
|
2017-04-24 06:49:05 +00:00
|
|
|
-- Reverse index, for Special:Whatlinkshere
|
2014-03-06 23:01:35 +00:00
|
|
|
CREATE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Index for Special:Whatlinkshere with namespace filter
|
2015-02-16 06:16:58 +00:00
|
|
|
CREATE INDEX /*i*/pl_backlinks_namespace ON /*_*/pagelinks (pl_from_namespace,pl_namespace,pl_title,pl_from);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2005-05-26 10:23:36 +00:00
|
|
|
|
2005-12-30 09:33:11 +00:00
|
|
|
--
|
|
|
|
|
-- Track template inclusions.
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/templatelinks (
|
2005-12-30 09:33:11 +00:00
|
|
|
-- Key to the page_id of the page containing the link.
|
2009-01-15 06:56:58 +00:00
|
|
|
tl_from int unsigned NOT NULL default 0,
|
2014-03-06 23:01:35 +00:00
|
|
|
-- Namespace for this page
|
|
|
|
|
tl_from_namespace int NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-12-30 09:33:11 +00:00
|
|
|
-- 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.
|
2009-01-15 06:56:58 +00:00
|
|
|
tl_namespace int NOT NULL default 0,
|
2017-08-04 12:43:50 +00:00
|
|
|
tl_title varchar(255) binary NOT NULL default '',
|
|
|
|
|
PRIMARY KEY (tl_from,tl_namespace,tl_title)
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2005-12-30 09:33:11 +00:00
|
|
|
|
2017-04-24 06:49:05 +00:00
|
|
|
-- Reverse index, for Special:Whatlinkshere
|
2014-03-06 23:01:35 +00:00
|
|
|
CREATE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Index for Special:Whatlinkshere with namespace filter
|
2015-02-16 06:16:58 +00:00
|
|
|
CREATE INDEX /*i*/tl_backlinks_namespace ON /*_*/templatelinks (tl_from_namespace,tl_namespace,tl_title,tl_from);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
|
|
|
|
|
2004-03-11 09:06:13 +00:00
|
|
|
--
|
|
|
|
|
-- Track links to images *used inline*
|
2005-05-02 08:07:38 +00:00
|
|
|
-- We don't distinguish live from broken links here, so
|
|
|
|
|
-- they do not need to be changed on upload/removal.
|
2004-03-11 09:06:13 +00:00
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/imagelinks (
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Key to page_id of the page containing the image / media link.
|
2009-01-15 06:56:58 +00:00
|
|
|
il_from int unsigned NOT NULL default 0,
|
2014-03-06 23:01:35 +00:00
|
|
|
-- Namespace for this page
|
|
|
|
|
il_from_namespace int NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Filename of target image.
|
|
|
|
|
-- This is also the page_title of the file's description page;
|
2008-12-01 17:14:30 +00:00
|
|
|
-- all such pages are in namespace 6 (NS_FILE).
|
2017-08-04 12:43:50 +00:00
|
|
|
il_to varchar(255) binary NOT NULL default '',
|
|
|
|
|
PRIMARY KEY (il_from,il_to)
|
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
|
|
|
-- Reverse index, for Special:Whatlinkshere and file description page local usage
|
2014-03-06 23:01:35 +00:00
|
|
|
CREATE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Index for Special:Whatlinkshere with namespace filter
|
2015-02-16 06:16:58 +00:00
|
|
|
CREATE INDEX /*i*/il_backlinks_namespace ON /*_*/imagelinks (il_from_namespace,il_to,il_from);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
|
|
|
|
|
2004-05-15 00:29:39 +00:00
|
|
|
--
|
|
|
|
|
-- Track category inclusions *used inline*
|
2005-05-02 08:07:38 +00:00
|
|
|
-- This tracks a single level of category membership
|
2004-05-15 00:29:39 +00:00
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/categorylinks (
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Key to page_id of the page defined as a category member.
|
2009-01-15 06:56:58 +00:00
|
|
|
cl_from int unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- 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).
|
2011-01-20 23:56:47 +00:00
|
|
|
cl_to varchar(255) binary NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2010-08-08 16:51:09 +00:00
|
|
|
-- A binary string obtained by applying a sortkey generation algorithm
|
2011-01-17 14:02:22 +00:00
|
|
|
-- (Collation::getSortKey()) to page_title, or cl_sortkey_prefix . "\n"
|
2010-08-08 16:51:09 +00:00
|
|
|
-- . page_title if cl_sortkey_prefix is nonempty.
|
cl_sortkey should be 230 bytes long, not 255
Bug 25503, reported by Dmitriy. When switching it to binary, I figured
that since it would always be one byte per character now, there would be
room to make it the full 255 bytes. In fact, if cl_to is utf8, the
(cl_to, cl_type, cl_sortkey, cl_from) index will be 255*3 + 1 + 255 + 4
= 1025 bytes, longer than the max of 1000. Shortening cl_sortkey to 230
bytes fixes this (fix tested by Dmitriy).
I didn't add an updater because if you're already running the current
schema without problems, you don't need this change.
2010-10-14 21:47:02 +00:00
|
|
|
cl_sortkey varbinary(230) NOT NULL default '',
|
2010-08-08 16:51:09 +00:00
|
|
|
|
|
|
|
|
-- A prefix for the raw sortkey manually specified by the user, either via
|
|
|
|
|
-- [[Category:Foo|prefix]] or {{defaultsort:prefix}}. If nonempty, it's
|
2011-01-17 14:02:22 +00:00
|
|
|
-- concatenated with a line break followed by the page title before the sortkey
|
2010-08-08 16:51:09 +00:00
|
|
|
-- conversion algorithm is run. We store this so that we can update
|
|
|
|
|
-- collations without reparsing all pages.
|
2011-01-06 22:09:58 +00:00
|
|
|
-- Note: If you change the length of this field, you also need to change
|
2017-02-20 22:48:21 +00:00
|
|
|
-- code in LinksUpdate.php. See T27254.
|
2011-01-20 23:56:47 +00:00
|
|
|
cl_sortkey_prefix varchar(255) binary NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- This isn't really used at present. Provided for an optional
|
|
|
|
|
-- sorting method by approximate addition time.
|
2010-08-08 16:51:09 +00:00
|
|
|
cl_timestamp timestamp NOT NULL,
|
|
|
|
|
|
Further categorylinks schema changes
Per review by Tim, I made two changes:
1) Fix cl_sortkey to be varbinary(255).
2) Expand cl_collation to varbinary(32), and change $wgCollationVersion
to $wgCategoryCollation, to account for the variety of collations we
might have. tinyint is too small. I could have gone with int, but
that's annoyingly inscrutable in practice, as we all know from namespace
fields.
To make the upgrade easier for non-trunk users, I updated the old patch
file to incorporate the new changes, using the updatelog table so that
people upgrading from 1.16 won't have to do two alters on categorylinks.
I didn't test the upgrade-from-1.16 code path yet, so if anyone tests
that and it seems not to break, commenting to that effect would be
appreciated.
Also removed wfDeprecated() from archive(). Do *not* add this to
functions that are still actively used in core. If you think this
function is so terrible that it really mustn't be used, remove callers
yourself, don't pester every single developer with messages in the hope
that someone else will do it for you.
2010-09-03 20:52:08 +00:00
|
|
|
-- 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
|
2010-08-08 16:51:09 +00:00
|
|
|
-- updated by updateCollation.php. In the future, it might be possible to
|
|
|
|
|
-- specify different collations per category.
|
Further categorylinks schema changes
Per review by Tim, I made two changes:
1) Fix cl_sortkey to be varbinary(255).
2) Expand cl_collation to varbinary(32), and change $wgCollationVersion
to $wgCategoryCollation, to account for the variety of collations we
might have. tinyint is too small. I could have gone with int, but
that's annoyingly inscrutable in practice, as we all know from namespace
fields.
To make the upgrade easier for non-trunk users, I updated the old patch
file to incorporate the new changes, using the updatelog table so that
people upgrading from 1.16 won't have to do two alters on categorylinks.
I didn't test the upgrade-from-1.16 code path yet, so if anyone tests
that and it seems not to break, commenting to that effect would be
appreciated.
Also removed wfDeprecated() from archive(). Do *not* add this to
functions that are still actively used in core. If you think this
function is so terrible that it really mustn't be used, remove callers
yourself, don't pester every single developer with messages in the hope
that someone else will do it for you.
2010-09-03 20:52:08 +00:00
|
|
|
cl_collation varbinary(32) NOT NULL default '',
|
2010-08-08 16:51:09 +00:00
|
|
|
|
|
|
|
|
-- 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.
|
2017-08-04 12:43:50 +00:00
|
|
|
cl_type ENUM('page', 'subcat', 'file') NOT NULL default 'page',
|
|
|
|
|
PRIMARY KEY (cl_from,cl_to)
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2004-05-15 00:29:39 +00:00
|
|
|
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2010-08-08 16:51:09 +00:00
|
|
|
-- 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);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2013-03-12 00:26:12 +00:00
|
|
|
-- Used by the API (and some extensions)
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/cl_timestamp ON /*_*/categorylinks (cl_to,cl_timestamp);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2016-02-21 21:59:14 +00:00
|
|
|
-- Used when updating collation (e.g. updateCollation.php)
|
|
|
|
|
CREATE INDEX /*i*/cl_collation_ext ON /*_*/categorylinks (cl_collation, cl_to, cl_type, cl_from);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2010-12-04 03:20:14 +00:00
|
|
|
--
|
2016-07-13 15:30:37 +00:00
|
|
|
-- 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.
|
This is a schema change. It's only a table creation, but the table must be created on Wikimedia servers before this revision goes live. The maintenance script populateCategory.php should be run when convenient. If it's not run, there's only one substantial case where display will be harmed: the page of a category with more than 200 net pages added since the patch goes live will give an erroneously low count. In other cases category pages will just be better-worded, and it will recognize the count in the table is bogus.
* Adds Category and CategoryList classes to represent categories themselves.
* Adds a category table, giving each category a name, ID, and counts of all members, subcats only, and files.
* Adds a maintenance script to populate the category table efficiently. This script is careful to wait for slaves and should be safe to run on a live database. The maintenance script's includes file is called by update.php.
* Until the category table is populated, the patch handles weird category table rows gracefully. It detects whether they're obviously impossible, and if so, it outputs appropriate messages.
2008-03-18 00:17:28 +00:00
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/category (
|
This is a schema change. It's only a table creation, but the table must be created on Wikimedia servers before this revision goes live. The maintenance script populateCategory.php should be run when convenient. If it's not run, there's only one substantial case where display will be harmed: the page of a category with more than 200 net pages added since the patch goes live will give an erroneously low count. In other cases category pages will just be better-worded, and it will recognize the count in the table is bogus.
* Adds Category and CategoryList classes to represent categories themselves.
* Adds a category table, giving each category a name, ID, and counts of all members, subcats only, and files.
* Adds a maintenance script to populate the category table efficiently. This script is careful to wait for slaves and should be safe to run on a live database. The maintenance script's includes file is called by update.php.
* Until the category table is populated, the patch handles weird category table rows gracefully. It detects whether they're obviously impossible, and if so, it outputs appropriate messages.
2008-03-18 00:17:28 +00:00
|
|
|
-- Primary key
|
2009-01-15 06:56:58 +00:00
|
|
|
cat_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
This is a schema change. It's only a table creation, but the table must be created on Wikimedia servers before this revision goes live. The maintenance script populateCategory.php should be run when convenient. If it's not run, there's only one substantial case where display will be harmed: the page of a category with more than 200 net pages added since the patch goes live will give an erroneously low count. In other cases category pages will just be better-worded, and it will recognize the count in the table is bogus.
* Adds Category and CategoryList classes to represent categories themselves.
* Adds a category table, giving each category a name, ID, and counts of all members, subcats only, and files.
* Adds a maintenance script to populate the category table efficiently. This script is careful to wait for slaves and should be safe to run on a live database. The maintenance script's includes file is called by update.php.
* Until the category table is populated, the patch handles weird category table rows gracefully. It detects whether they're obviously impossible, and if so, it outputs appropriate messages.
2008-03-18 00:17:28 +00:00
|
|
|
|
|
|
|
|
-- 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).
|
2011-01-20 23:56:47 +00:00
|
|
|
cat_title varchar(255) binary NOT NULL,
|
This is a schema change. It's only a table creation, but the table must be created on Wikimedia servers before this revision goes live. The maintenance script populateCategory.php should be run when convenient. If it's not run, there's only one substantial case where display will be harmed: the page of a category with more than 200 net pages added since the patch goes live will give an erroneously low count. In other cases category pages will just be better-worded, and it will recognize the count in the table is bogus.
* Adds Category and CategoryList classes to represent categories themselves.
* Adds a category table, giving each category a name, ID, and counts of all members, subcats only, and files.
* Adds a maintenance script to populate the category table efficiently. This script is careful to wait for slaves and should be safe to run on a live database. The maintenance script's includes file is called by update.php.
* Until the category table is populated, the patch handles weird category table rows gracefully. It detects whether they're obviously impossible, and if so, it outputs appropriate messages.
2008-03-18 00:17:28 +00:00
|
|
|
|
|
|
|
|
-- The numbers of member pages (including categories and media), subcatego-
|
|
|
|
|
-- ries, and Image: namespace members, respectively. 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 order-
|
|
|
|
|
-- ing is not.
|
|
|
|
|
cat_pages int signed NOT NULL default 0,
|
|
|
|
|
cat_subcats int signed NOT NULL default 0,
|
2012-08-03 19:33:18 +00:00
|
|
|
cat_files int signed NOT NULL default 0
|
This is a schema change. It's only a table creation, but the table must be created on Wikimedia servers before this revision goes live. The maintenance script populateCategory.php should be run when convenient. If it's not run, there's only one substantial case where display will be harmed: the page of a category with more than 200 net pages added since the patch goes live will give an erroneously low count. In other cases category pages will just be better-worded, and it will recognize the count in the table is bogus.
* Adds Category and CategoryList classes to represent categories themselves.
* Adds a category table, giving each category a name, ID, and counts of all members, subcats only, and files.
* Adds a maintenance script to populate the category table efficiently. This script is careful to wait for slaves and should be safe to run on a live database. The maintenance script's includes file is called by update.php.
* Until the category table is populated, the patch handles weird category table rows gracefully. It detects whether they're obviously impossible, and if so, it outputs appropriate messages.
2008-03-18 00:17:28 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/cat_title ON /*_*/category (cat_title);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
|
|
|
|
-- For Special:Mostlinkedcategories
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/cat_pages ON /*_*/category (cat_pages);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
|
|
|
|
|
2006-01-26 13:29:14 +00:00
|
|
|
--
|
|
|
|
|
-- Track links to external URLs
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/externallinks (
|
2012-10-28 02:23:50 +00:00
|
|
|
-- Primary key
|
|
|
|
|
el_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
|
|
|
|
2006-01-26 13:29:14 +00:00
|
|
|
-- page_id of the referring page
|
2009-01-15 06:56:58 +00:00
|
|
|
el_from int unsigned NOT NULL default 0,
|
2006-01-26 13:29:14 +00:00
|
|
|
|
|
|
|
|
-- The URL
|
2006-12-21 21:40:43 +00:00
|
|
|
el_to blob NOT NULL,
|
2006-01-26 13:29:14 +00:00
|
|
|
|
|
|
|
|
-- In the case of HTTP URLs, this is the URL with any username or password
|
2010-12-04 03:20:14 +00:00
|
|
|
-- removed, and with the labels in the hostname reversed and converted to
|
2006-01-26 13:29:14 +00:00
|
|
|
-- lower case. An extra dot is added to allow for matching of either
|
|
|
|
|
-- example.com or *.example.com in a single scan.
|
2010-12-04 03:20:14 +00:00
|
|
|
-- Example:
|
2006-01-26 13:29:14 +00:00
|
|
|
-- http://user:password@sub.example.com/page.html
|
|
|
|
|
-- becomes
|
|
|
|
|
-- http://com.example.sub./page.html
|
|
|
|
|
-- which allows for fast searching for all pages under example.com with the
|
2010-12-04 03:20:14 +00:00
|
|
|
-- clause:
|
2006-01-26 13:29:14 +00:00
|
|
|
-- WHERE el_index LIKE 'http://com.example.%'
|
2016-11-18 19:54:28 +00:00
|
|
|
el_index blob NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- This is el_index truncated to 60 bytes to allow for sortable queries that
|
|
|
|
|
-- aren't supported by a partial index.
|
|
|
|
|
-- @todo Drop the default once this is deployed everywhere and code is populating it.
|
|
|
|
|
el_index_60 varbinary(60) NOT NULL default ''
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2006-01-26 13:29:14 +00:00
|
|
|
|
2017-04-24 06:49:05 +00:00
|
|
|
-- Forward index, for page edit, save
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/el_from ON /*_*/externallinks (el_from, el_to(40));
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Index for Special:LinkSearch exact search
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/el_to ON /*_*/externallinks (el_to(60), el_from);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- For Special:LinkSearch wildcard search
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/el_index ON /*_*/externallinks (el_index(60));
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- For Special:LinkSearch wildcard search with efficient paging by el_id
|
2016-11-18 19:54:28 +00:00
|
|
|
CREATE INDEX /*i*/el_index_60 ON /*_*/externallinks (el_index_60, el_id);
|
|
|
|
|
CREATE INDEX /*i*/el_from_index_60 ON /*_*/externallinks (el_from, el_index_60, el_id);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2010-12-04 03:20:14 +00:00
|
|
|
--
|
2006-04-11 14:56:04 +00:00
|
|
|
-- Track interlanguage links
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/langlinks (
|
2006-04-11 14:56:04 +00:00
|
|
|
-- page_id of the referring page
|
2009-01-15 06:56:58 +00:00
|
|
|
ll_from int unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2006-04-11 14:56:04 +00:00
|
|
|
-- Language code of the target
|
2007-06-22 18:31:24 +00:00
|
|
|
ll_lang varbinary(20) NOT NULL default '',
|
2006-04-11 14:56:04 +00:00
|
|
|
|
|
|
|
|
-- Title of the target, including namespace
|
2017-08-04 12:43:50 +00:00
|
|
|
ll_title varchar(255) binary NOT NULL default '',
|
|
|
|
|
PRIMARY KEY (ll_from,ll_lang)
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2006-04-11 14:56:04 +00:00
|
|
|
|
2017-04-24 06:49:05 +00:00
|
|
|
-- Index for ApiQueryLangbacklinks
|
2009-01-19 14:12:59 +00:00
|
|
|
CREATE INDEX /*i*/ll_lang ON /*_*/langlinks (ll_lang, ll_title);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
|
|
|
|
|
2010-12-04 03:20:14 +00:00
|
|
|
--
|
2010-04-16 01:40:05 +00:00
|
|
|
-- Track inline interwiki links
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE /*_*/iwlinks (
|
|
|
|
|
-- page_id of the referring page
|
|
|
|
|
iwl_from int unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2010-04-16 01:40:05 +00:00
|
|
|
-- Interwiki prefix code of the target
|
|
|
|
|
iwl_prefix varbinary(20) NOT NULL default '',
|
|
|
|
|
|
|
|
|
|
-- Title of the target, including namespace
|
2017-08-04 12:43:50 +00:00
|
|
|
iwl_title varchar(255) binary NOT NULL default '',
|
|
|
|
|
PRIMARY KEY (iwl_from,iwl_prefix,iwl_title)
|
2010-04-16 01:40:05 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
2017-04-24 06:49:05 +00:00
|
|
|
-- Index for ApiQueryIWBacklinks
|
2013-01-11 00:22:03 +00:00
|
|
|
CREATE INDEX /*i*/iwl_prefix_title_from ON /*_*/iwlinks (iwl_prefix, iwl_title, iwl_from);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Index for ApiQueryIWLinks
|
2013-01-11 00:22:03 +00:00
|
|
|
CREATE INDEX /*i*/iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title);
|
2010-04-16 01:40:05 +00:00
|
|
|
|
|
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
|
|
|
|
-- Contains a single row with some aggregate info
|
|
|
|
|
-- on the state of the site.
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/site_stats (
|
2005-05-02 08:07:38 +00:00
|
|
|
-- The single row should contain 1 here.
|
2017-08-04 12:43:50 +00:00
|
|
|
ss_row_id int unsigned NOT NULL PRIMARY KEY,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Total number of edits performed.
|
2017-05-08 19:31:54 +00:00
|
|
|
ss_total_edits bigint unsigned default NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2017-05-08 19:31:54 +00:00
|
|
|
-- See SiteStatsInit::articles().
|
|
|
|
|
ss_good_articles bigint unsigned default NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2017-05-08 19:31:54 +00:00
|
|
|
-- Total pages, theoretically equal to SELECT COUNT(*) FROM page.
|
|
|
|
|
ss_total_pages bigint unsigned default NULL,
|
2005-06-19 00:21:49 +00:00
|
|
|
|
2017-05-08 19:31:54 +00:00
|
|
|
-- Number of users, theoretically equal to SELECT COUNT(*) FROM user.
|
|
|
|
|
ss_users bigint unsigned default NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2017-05-08 19:31:54 +00:00
|
|
|
-- Number of users that still edit.
|
|
|
|
|
ss_active_users bigint unsigned default NULL,
|
2005-06-19 00:21:49 +00:00
|
|
|
|
2017-05-08 19:31:54 +00:00
|
|
|
-- Number of images, equivalent to SELECT COUNT(*) FROM image.
|
|
|
|
|
ss_images bigint unsigned default NULL
|
2009-01-15 06:56:58 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2006-03-28 05:09:33 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
|
|
|
|
-- The internet is full of jerks, alas. Sometimes it's handy
|
|
|
|
|
-- to block a vandal or troll account.
|
|
|
|
|
--
|
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
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- User ID who made the block.
|
2017-09-12 17:12:29 +00:00
|
|
|
ipb_by int unsigned NOT NULL default 0, -- Deprecated in favor of ipb_by_actor
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2008-02-23 16:58:23 +00:00
|
|
|
-- User name of blocker
|
2017-09-12 17:12:29 +00:00
|
|
|
ipb_by_text varchar(255) binary NOT NULL default '', -- Deprecated in favor of ipb_by_actor
|
|
|
|
|
|
|
|
|
|
-- Actor who made the block.
|
|
|
|
|
ipb_by_actor bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that ipb_by/ipb_by_text should be used)
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2017-06-06 17:39:14 +00:00
|
|
|
-- Text comment made by blocker. Deprecated in favor of ipb_reason_id
|
|
|
|
|
ipb_reason varbinary(767) NOT NULL default '',
|
|
|
|
|
|
|
|
|
|
-- Key to comment_id. Text comment made by blocker.
|
|
|
|
|
-- ("DEFAULT 0" is temporary, signaling that ipb_reason should be used)
|
|
|
|
|
ipb_reason_id bigint unsigned NOT NULL DEFAULT 0,
|
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
|
|
|
|
|
ipb_parent_block_id int default NULL
|
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
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only);
|
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
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Description field as entered by the uploader.
|
|
|
|
|
-- This is displayed in image upload history and logs.
|
2017-06-06 17:39:14 +00:00
|
|
|
-- Deprecated in favor of image_comment_temp.imgcomment_description_id.
|
|
|
|
|
img_description varbinary(767) NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- user_id and user_name of uploader.
|
2017-09-12 17:12:29 +00:00
|
|
|
-- Deprecated in favor of img_actor.
|
2009-01-15 06:56:58 +00:00
|
|
|
img_user int unsigned NOT NULL default 0,
|
2017-09-12 17:12:29 +00:00
|
|
|
img_user_text varchar(255) binary NOT NULL DEFAULT '',
|
|
|
|
|
|
|
|
|
|
-- actor_id of the uploader.
|
|
|
|
|
-- ("DEFAULT 0" is temporary, signaling that img_user/img_user_text should be used)
|
|
|
|
|
img_actor bigint unsigned NOT NULL DEFAULT 0,
|
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
|
|
|
|
|
CREATE INDEX /*i*/img_user_timestamp ON /*_*/image (img_user,img_timestamp);
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp);
|
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
|
|
|
|
2017-06-06 17:39:14 +00:00
|
|
|
--
|
|
|
|
|
-- Temporary table to avoid blocking on an alter of image.
|
|
|
|
|
--
|
|
|
|
|
-- On large wikis like Wikimedia Commons, altering the image table is a
|
|
|
|
|
-- months-long process. This table is being created to avoid such an alter, and
|
|
|
|
|
-- will be merged back into image in the future.
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE /*_*/image_comment_temp (
|
|
|
|
|
-- Key to img_name (ugh)
|
|
|
|
|
imgcomment_name varchar(255) binary NOT NULL,
|
|
|
|
|
-- Key to comment_id
|
|
|
|
|
imgcomment_description_id bigint unsigned NOT NULL,
|
|
|
|
|
PRIMARY KEY (imgcomment_name, imgcomment_description_id)
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
-- Ensure uniqueness
|
|
|
|
|
CREATE UNIQUE INDEX /*i*/imgcomment_name ON /*_*/image_comment_temp (imgcomment_name);
|
|
|
|
|
|
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,
|
2017-06-06 17:39:14 +00:00
|
|
|
oi_description varbinary(767) NOT NULL default '', -- Deprecated.
|
|
|
|
|
oi_description_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that oi_description should be used)
|
2017-09-12 17:12:29 +00:00
|
|
|
oi_user int unsigned NOT NULL default 0, -- Deprecated in favor of oi_actor
|
|
|
|
|
oi_user_text varchar(255) binary NOT NULL DEFAULT '', -- Deprecated in favor of oi_actor
|
|
|
|
|
oi_actor bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that oi_user/oi_user_text should be used)
|
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
|
|
|
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp);
|
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 '',
|
2017-06-06 17:39:14 +00:00
|
|
|
fa_deleted_reason varbinary(767) default '', -- Deprecated
|
|
|
|
|
fa_deleted_reason_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that fa_deleted_reason should be used)
|
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",
|
2017-06-06 17:39:14 +00:00
|
|
|
fa_description varbinary(767) default '', -- Deprecated
|
|
|
|
|
fa_description_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that fa_description should be used)
|
2017-09-12 17:12:29 +00:00
|
|
|
fa_user int unsigned default 0, -- Deprecated in favor of fa_actor
|
|
|
|
|
fa_user_text varchar(255) binary DEFAULT '', -- Deprecated in favor of fa_actor
|
|
|
|
|
fa_actor bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that fa_user/fa_user_text should be used)
|
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
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp);
|
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
|
|
|
|
|
|
|
|
|
2011-07-12 21:11:43 +00:00
|
|
|
--
|
2011-07-23 08:15:11 +00:00
|
|
|
-- Store information about newly uploaded files before they're
|
2011-07-12 21:11:43 +00:00
|
|
|
-- moved into the actual filestore
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE /*_*/uploadstash (
|
2012-03-24 21:14:09 +00:00
|
|
|
us_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2011-07-23 08:15:11 +00:00
|
|
|
|
2012-03-24 21:14:09 +00:00
|
|
|
-- the user who uploaded the file.
|
|
|
|
|
us_user int unsigned NOT NULL,
|
2011-07-12 21:11:43 +00:00
|
|
|
|
2012-03-24 21:14:09 +00:00
|
|
|
-- file key. this is how applications actually search for the file.
|
|
|
|
|
-- this might go away, or become the primary key.
|
|
|
|
|
us_key varchar(255) NOT NULL,
|
2011-07-12 21:11:43 +00:00
|
|
|
|
2012-03-24 21:14:09 +00:00
|
|
|
-- the original path
|
|
|
|
|
us_orig_path varchar(255) NOT NULL,
|
2011-07-23 08:15:11 +00:00
|
|
|
|
2012-03-24 21:14:09 +00:00
|
|
|
-- the temporary path at which the file is actually stored
|
|
|
|
|
us_path varchar(255) NOT NULL,
|
2011-07-23 08:15:11 +00:00
|
|
|
|
2012-03-24 21:14:09 +00:00
|
|
|
-- which type of upload the file came from (sometimes)
|
|
|
|
|
us_source_type varchar(50),
|
2011-07-23 08:15:11 +00:00
|
|
|
|
2012-03-24 21:14:09 +00:00
|
|
|
-- the date/time on which the file was added
|
|
|
|
|
us_timestamp varbinary(14) NOT NULL,
|
2011-07-23 08:15:11 +00:00
|
|
|
|
2012-03-24 21:14:09 +00:00
|
|
|
us_status varchar(50) NOT NULL,
|
2011-12-22 13:18:49 +00:00
|
|
|
|
2012-03-24 21:14:09 +00:00
|
|
|
-- chunk counter starts at 0, current offset is stored in us_size
|
|
|
|
|
us_chunk_inx int unsigned NULL,
|
2011-07-12 21:11:43 +00:00
|
|
|
|
2014-06-23 18:58:37 +00:00
|
|
|
-- Serialized file properties from FSFile::getProps()
|
2012-11-21 21:58:50 +00:00
|
|
|
us_props blob,
|
|
|
|
|
|
|
|
|
|
-- file size in bytes
|
2012-03-24 21:14:09 +00:00
|
|
|
us_size int unsigned NOT NULL,
|
2014-06-23 18:58:37 +00:00
|
|
|
-- this hash comes from FSFile::getSha1Base36(), and is 31 characters
|
2012-03-24 21:14:09 +00:00
|
|
|
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
|
2017-02-07 18:19:10 +00:00
|
|
|
us_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL,
|
2012-03-24 21:14:09 +00:00
|
|
|
-- image-specific properties
|
|
|
|
|
us_image_width int unsigned,
|
|
|
|
|
us_image_height int unsigned,
|
|
|
|
|
us_image_bits smallint unsigned
|
2011-07-23 08:15:11 +00:00
|
|
|
|
2011-07-12 21:11:43 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
|
|
|
|
-- sometimes there's a delete for all of a user's stuff.
|
|
|
|
|
CREATE INDEX /*i*/us_user ON /*_*/uploadstash (us_user);
|
|
|
|
|
-- pick out files by key, enforce key uniqueness
|
|
|
|
|
CREATE UNIQUE INDEX /*i*/us_key ON /*_*/uploadstash (us_key);
|
2011-07-13 00:38:04 +00:00
|
|
|
-- the abandoned upload cleanup script needs this
|
|
|
|
|
CREATE INDEX /*i*/us_timestamp ON /*_*/uploadstash (us_timestamp);
|
2011-07-12 21:11:43 +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
|
2017-09-12 17:12:29 +00:00
|
|
|
rc_user int unsigned NOT NULL default 0, -- Deprecated in favor of rc_actor
|
|
|
|
|
rc_user_text varchar(255) binary NOT NULL DEFAULT '', -- Deprecated in favor of rc_actor
|
|
|
|
|
rc_actor bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that rc_user/rc_user_text should be used)
|
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...
|
2017-06-06 17:39:14 +00:00
|
|
|
rc_comment varbinary(767) NOT NULL default '', -- Deprecated.
|
|
|
|
|
rc_comment_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that rc_comment should be used)
|
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
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title);
|
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
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text);
|
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
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp);
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE /*_*/watchlist (
|
2016-02-17 23:16:20 +00:00
|
|
|
wl_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2005-10-14 06:27:43 +00:00
|
|
|
-- Key to user.user_id
|
2007-06-22 18:31:24 +00:00
|
|
|
wl_user int unsigned NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Key to page_namespace/page_title
|
2005-10-14 06:27:43 +00:00
|
|
|
-- Note that users may watch pages which do not exist yet,
|
2005-05-02 08:07:38 +00:00
|
|
|
-- or existed in the past but have been deleted.
|
2009-01-15 06:56:58 +00:00
|
|
|
wl_namespace int NOT NULL default 0,
|
2011-01-20 23:56:47 +00:00
|
|
|
wl_title varchar(255) binary NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
Correctly update wl_notificationtimestamp when viewing old revisions
== Prelude ==
wl_notificationtimestamp controls sending the user e-mail
notifications about changes to pages, as well as showing the "updated
since last visit" markers on history pages, recent changes and
watchlist.
== The bug ==
Previously, on every view of a page, the notification timestamp was
cleared, regardless of whether the user as actually viewing the latest
revision. When viewing a diff, however, the timestamp was cleared only
if one of the revisions being compared was the latest one of its page.
The same behavior applied to talk page message indicators (which are
actually stored sepately to cater to anonymous users).
This was inconsistent and surprising when one was attempting to, say,
go through the 50 new posts to a discussion page in a peacemeal
fashion.
== The fix ==
If the revision being viewed is the latest (or can't be determined),
the timestamp is cleared as previously, as this is necessary to
reenable e-mail notifications for given user and page.
If the revision isn't the latest, the timestamp is updated to
revision's timestamp plus one second. This uses up to two simple
(selectField) indexed queries per page view, only fired when we
do not already know we're looking at the latest version.
Talk page indicator is updated to point at the next revision after the
one being viewed, or cleared if viewing the latest revision. The
UserClearNewTalkNotification hook gained $oldid as the second argument
(a backwards-compatible change). In Skin, we no longer ignore the
indicator being present if we're viewing the talk page, as it might
still be valid.
== The bonus ==
Comments and formatting was updated in a few places, including
tables.sql and Wiki.php.
The following functions gained a second, optional $oldid parameter
(holy indirection, Batman!):
* WikiPage#doViewUpdates()
* User#clearNotification()
* WatchedItem#resetNotificationTimestamp()
DifferenceEngine gained a public method mapDiffPrevNext() used
to parse the ids from URL parameters like oldid=12345&diff=prev,
factored out of loadRevisionIds(). A bug where the NewDifferenceEngine
hook would not be called in some cases, dating back to its
introduction in r45518, was fixed in the process.
Bug: 41759
Change-Id: I4144ba1987b8d7a7e8b24f4f067eedac2ae44459
2013-09-16 10:31:40 +00:00
|
|
|
-- 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.
|
2009-01-15 06:56:58 +00:00
|
|
|
wl_notificationtimestamp varbinary(14)
|
2010-12-04 03:20:14 +00:00
|
|
|
|
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:Watchlist
|
2009-01-19 14:12:59 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/wl_user ON /*_*/watchlist (wl_user, wl_namespace, wl_title);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Special:Movepage (WatchedItemStore::duplicateEntry)
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/namespace_title ON /*_*/watchlist (wl_namespace, wl_title);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- ApiQueryWatchlistRaw changed filter
|
2014-06-03 19:20:04 +00:00
|
|
|
CREATE INDEX /*i*/wl_user_notificationtimestamp ON /*_*/watchlist (wl_user, wl_notificationtimestamp);
|
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
|
|
|
--
|
|
|
|
|
-- Recognized interwiki link prefixes
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/interwiki (
|
2005-05-02 08:07:38 +00:00
|
|
|
-- The interwiki prefix, (e.g. "Meatball", or the language prefix "de")
|
2011-01-20 23:56:47 +00:00
|
|
|
iw_prefix varchar(32) NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- 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.
|
2007-06-22 18:31:24 +00:00
|
|
|
iw_url blob NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2010-07-19 11:55:30 +00:00
|
|
|
-- The URL of the file api.php
|
|
|
|
|
iw_api blob NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- The name of the database (for a connection to be established with wfGetLB( 'wikiid' ))
|
2011-01-20 23:56:47 +00:00
|
|
|
iw_wikiid varchar(64) NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- A boolean value indicating whether the wiki is in this project
|
|
|
|
|
-- (used, for example, to detect redirect loops)
|
2006-07-22 16:43:28 +00:00
|
|
|
iw_local bool NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-07-05 03:08:29 +00:00
|
|
|
-- Boolean value indicating whether interwiki transclusions are allowed.
|
2009-01-15 06:56:58 +00:00
|
|
|
iw_trans tinyint NOT NULL default 0
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2003-08-21 11:20:38 +00:00
|
|
|
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/iw_prefix ON /*_*/interwiki (iw_prefix);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
|
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
2004-05-09 01:30:34 +00:00
|
|
|
-- Used for caching expensive grouped queries
|
2005-05-02 08:07:38 +00:00
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/querycache (
|
2005-05-02 08:07:38 +00:00
|
|
|
-- A key name, generally the base name of of the special page.
|
2007-06-22 18:31:24 +00:00
|
|
|
qc_type varbinary(32) NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Some sort of stored value. Sizes, counts...
|
2009-01-15 06:56:58 +00:00
|
|
|
qc_value int unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2005-05-02 08:07:38 +00:00
|
|
|
-- Target namespace+title
|
2009-01-15 06:56:58 +00:00
|
|
|
qc_namespace int NOT NULL default 0,
|
2011-01-20 23:56:47 +00:00
|
|
|
qc_title varchar(255) binary NOT NULL default ''
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2004-05-09 05:12:55 +00:00
|
|
|
|
2009-01-19 14:12:59 +00:00
|
|
|
CREATE INDEX /*i*/qc_type ON /*_*/querycache (qc_type,qc_value);
|
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
|
|
|
|
2004-06-15 15:18:50 +00:00
|
|
|
|
2006-01-31 03:44:08 +00:00
|
|
|
--
|
|
|
|
|
-- Cache of interwiki transclusion
|
|
|
|
|
--
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/transcache (
|
2017-08-04 12:43:50 +00:00
|
|
|
tc_url varbinary(255) NOT NULL PRIMARY KEY,
|
2006-07-22 16:43:28 +00:00
|
|
|
tc_contents text,
|
2009-12-10 05:39:45 +00:00
|
|
|
tc_time binary(14) NOT NULL
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2006-01-31 03:44:08 +00:00
|
|
|
|
2009-01-15 06:56:58 +00:00
|
|
|
|
|
|
|
|
CREATE TABLE /*_*/logging (
|
2008-04-09 15:19:54 +00:00
|
|
|
-- Log ID, for referring to this specific log entry, probably for deletion and such.
|
2009-01-15 06:56:58 +00:00
|
|
|
log_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2008-04-09 15:19:54 +00:00
|
|
|
|
2004-08-24 08:11:46 +00:00
|
|
|
-- Symbolic keys for the general log type and the action type
|
|
|
|
|
-- within the log. The output format will be controlled by the
|
|
|
|
|
-- action field, but only the type controls categorization.
|
2009-07-17 17:50:28 +00:00
|
|
|
log_type varbinary(32) NOT NULL default '',
|
|
|
|
|
log_action varbinary(32) NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2004-08-24 08:11:46 +00:00
|
|
|
-- Timestamp. Duh.
|
2007-06-22 18:31:24 +00:00
|
|
|
log_timestamp binary(14) NOT NULL default '19700101000000',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2004-08-24 08:11:46 +00:00
|
|
|
-- The user who performed this action; key to user_id
|
2017-09-12 17:12:29 +00:00
|
|
|
log_user int unsigned NOT NULL default 0, -- Deprecated in favor of log_actor
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2009-07-17 17:45:53 +00:00
|
|
|
-- Name of the user who performed this action
|
2017-09-12 17:12:29 +00:00
|
|
|
log_user_text varchar(255) binary NOT NULL default '', -- Deprecated in favor of log_actor
|
|
|
|
|
|
|
|
|
|
-- The actor who performed this action
|
|
|
|
|
log_actor bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that log_user/log_user_text should be used)
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2004-08-24 08:11:46 +00:00
|
|
|
-- Key to the page affected. Where a user is the target,
|
|
|
|
|
-- this will point to the user page.
|
2005-05-02 10:15:02 +00:00
|
|
|
log_namespace int NOT NULL default 0,
|
2011-01-20 23:56:47 +00:00
|
|
|
log_title varchar(255) binary NOT NULL default '',
|
2009-07-17 17:45:53 +00:00
|
|
|
log_page int unsigned NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2004-08-24 08:11:46 +00:00
|
|
|
-- Freeform text. Interpreted as edit history comments.
|
2017-06-06 17:39:14 +00:00
|
|
|
-- Deprecated in favor of log_comment_id.
|
2015-02-20 00:31:31 +00:00
|
|
|
log_comment varbinary(767) NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2017-06-06 17:39:14 +00:00
|
|
|
-- Key to comment_id. Comment summarizing the change.
|
|
|
|
|
-- ("DEFAULT 0" is temporary, signaling that log_comment should be used)
|
|
|
|
|
log_comment_id bigint unsigned NOT NULL DEFAULT 0,
|
|
|
|
|
|
2012-12-02 13:26:28 +00:00
|
|
|
-- miscellaneous parameters:
|
|
|
|
|
-- LF separated list (old system) or serialized PHP array (new system)
|
2006-12-21 21:40:43 +00:00
|
|
|
log_params blob NOT NULL,
|
2005-01-14 13:47:19 +00:00
|
|
|
|
2007-03-14 22:00:59 +00:00
|
|
|
-- rev_deleted for logs
|
2009-01-15 06:56:58 +00:00
|
|
|
log_deleted tinyint unsigned NOT NULL default 0
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
2007-03-14 22:00:59 +00:00
|
|
|
|
2017-04-24 06:49:05 +00:00
|
|
|
-- Special:Log type filter
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/type_time ON /*_*/logging (log_type, log_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Special:Log performer filter
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/user_time ON /*_*/logging (log_user, log_timestamp);
|
2017-09-12 17:12:29 +00:00
|
|
|
CREATE INDEX /*i*/actor_time ON /*_*/logging (log_actor, log_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Special:Log title filter, log extract
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/page_time ON /*_*/logging (log_namespace, log_title, log_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Special:Log unfiltered
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/times ON /*_*/logging (log_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Special:Log filter by performer and type
|
2009-07-17 17:45:53 +00:00
|
|
|
CREATE INDEX /*i*/log_user_type_time ON /*_*/logging (log_user, log_type, log_timestamp);
|
2017-09-12 17:12:29 +00:00
|
|
|
CREATE INDEX /*i*/log_actor_type_time ON /*_*/logging (log_actor, log_type, log_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Apparently just used for a few maintenance pages (findMissingFiles.php, Flow).
|
|
|
|
|
-- Could be removed?
|
2009-07-17 17:45:53 +00:00
|
|
|
CREATE INDEX /*i*/log_page_id_time ON /*_*/logging (log_page,log_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Special:Log action filter
|
2012-03-24 21:14:09 +00:00
|
|
|
CREATE INDEX /*i*/type_action ON /*_*/logging (log_type, log_action, log_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Special:Log filter by type and anonymous performer
|
2013-12-09 21:11:06 +00:00
|
|
|
CREATE INDEX /*i*/log_user_text_type_time ON /*_*/logging (log_user_text, log_type, log_timestamp);
|
2017-04-24 06:49:05 +00:00
|
|
|
|
|
|
|
|
-- Special:Log filter by anonymous performer
|
2013-12-09 21:11:06 +00:00
|
|
|
CREATE INDEX /*i*/log_user_text_time ON /*_*/logging (log_user_text, log_timestamp);
|
2005-05-02 08:40:17 +00:00
|
|
|
|
2004-10-02 22:26:00 +00:00
|
|
|
|
2009-05-13 22:03:32 +00:00
|
|
|
CREATE TABLE /*_*/log_search (
|
2009-05-14 22:43:57 +00:00
|
|
|
-- The type of ID (rev ID, log ID, rev timestamp, username)
|
|
|
|
|
ls_field varbinary(32) NOT NULL,
|
|
|
|
|
-- The value of the ID
|
2011-01-20 23:56:47 +00:00
|
|
|
ls_value varchar(255) NOT NULL,
|
2009-05-14 22:43:57 +00:00
|
|
|
-- Key to log_id
|
2017-08-04 12:43:50 +00:00
|
|
|
ls_log_id int unsigned NOT NULL default 0,
|
|
|
|
|
PRIMARY KEY (ls_field,ls_value,ls_log_id)
|
2009-05-14 22:43:57 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2009-05-13 22:03:32 +00:00
|
|
|
CREATE INDEX /*i*/ls_log_id ON /*_*/log_search (ls_log_id);
|
|
|
|
|
|
|
|
|
|
|
2006-02-24 01:56:31 +00:00
|
|
|
-- Jobs performed by parallel apache threads or a command-line daemon
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/job (
|
|
|
|
|
job_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2007-06-22 18:31:24 +00:00
|
|
|
-- Command name
|
|
|
|
|
-- Limited to 60 to prevent key length overflow
|
|
|
|
|
job_cmd varbinary(60) NOT NULL default '',
|
2006-02-24 01:56:31 +00:00
|
|
|
|
|
|
|
|
-- Namespace and title to act on
|
|
|
|
|
-- Should be 0 and '' if the command does not operate on a title
|
|
|
|
|
job_namespace int NOT NULL,
|
2011-01-20 23:56:47 +00:00
|
|
|
job_title varchar(255) binary NOT NULL,
|
2006-02-24 01:56:31 +00:00
|
|
|
|
2012-01-03 15:08:05 +00:00
|
|
|
-- Timestamp of when the job was inserted
|
|
|
|
|
-- NULL for jobs added before addition of the timestamp
|
|
|
|
|
job_timestamp varbinary(14) NULL default NULL,
|
|
|
|
|
|
2006-02-24 01:56:31 +00:00
|
|
|
-- Any other parameters to the command
|
2009-01-15 06:56:58 +00:00
|
|
|
-- Stored as a PHP serialized array, or an empty string if there are no parameters
|
2012-08-29 00:01:31 +00:00
|
|
|
job_params blob NOT NULL,
|
|
|
|
|
|
2012-10-24 00:29:54 +00:00
|
|
|
-- Random, non-unique, number used for job acquisition (for lock concurrency)
|
2012-08-29 00:01:31 +00:00
|
|
|
job_random integer unsigned NOT NULL default 0,
|
|
|
|
|
|
2012-10-24 00:29:54 +00:00
|
|
|
-- The number of times this job has been locked
|
|
|
|
|
job_attempts integer unsigned NOT NULL default 0,
|
|
|
|
|
|
2012-08-29 00:01:31 +00:00
|
|
|
-- Field that conveys process locks on rows via process UUIDs
|
|
|
|
|
job_token varbinary(32) NOT NULL default '',
|
|
|
|
|
|
|
|
|
|
-- Timestamp when the job was locked
|
|
|
|
|
job_token_timestamp varbinary(14) NULL default NULL,
|
|
|
|
|
|
|
|
|
|
-- Base 36 SHA1 of the job parameters relevant to detecting duplicates
|
|
|
|
|
job_sha1 varbinary(32) NOT NULL default ''
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2006-04-17 04:30:39 +00:00
|
|
|
|
2012-08-29 00:01:31 +00:00
|
|
|
CREATE INDEX /*i*/job_sha1 ON /*_*/job (job_sha1);
|
|
|
|
|
CREATE INDEX /*i*/job_cmd_token ON /*_*/job (job_cmd,job_token,job_random);
|
2012-10-24 00:29:54 +00:00
|
|
|
CREATE INDEX /*i*/job_cmd_token_id ON /*_*/job (job_cmd,job_token,job_id);
|
2009-10-10 09:14:51 +00:00
|
|
|
CREATE INDEX /*i*/job_cmd ON /*_*/job (job_cmd, job_namespace, job_title, job_params(128));
|
2012-03-24 21:14:09 +00:00
|
|
|
CREATE INDEX /*i*/job_timestamp ON /*_*/job (job_timestamp);
|
2006-04-17 04:30:39 +00:00
|
|
|
|
|
|
|
|
|
2009-01-15 06:56:58 +00:00
|
|
|
-- Details of updates to cached special pages
|
|
|
|
|
CREATE TABLE /*_*/querycache_info (
|
2006-07-10 06:30:03 +00:00
|
|
|
-- Special page name
|
|
|
|
|
-- Corresponds to a qc_type value
|
2017-08-04 12:43:50 +00:00
|
|
|
qci_type varbinary(32) NOT NULL default '' PRIMARY KEY,
|
2006-04-17 04:30:39 +00:00
|
|
|
|
2006-07-10 06:30:03 +00:00
|
|
|
-- Timestamp of last update
|
2009-01-15 06:56:58 +00:00
|
|
|
qci_timestamp binary(14) NOT NULL default '19700101000000'
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
2006-04-17 04:30:39 +00:00
|
|
|
|
2006-07-10 06:30:03 +00:00
|
|
|
|
2006-10-25 07:26:59 +00:00
|
|
|
-- For each redirect, this table contains exactly one row defining its target
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/redirect (
|
2006-10-25 07:26:59 +00:00
|
|
|
-- Key to the page_id of the redirect page
|
2009-01-19 14:12:59 +00:00
|
|
|
rd_from int unsigned NOT NULL default 0 PRIMARY KEY,
|
2006-10-25 07:26:59 +00:00
|
|
|
|
|
|
|
|
-- 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.
|
2009-01-15 06:56:58 +00:00
|
|
|
rd_namespace int NOT NULL default 0,
|
2011-01-20 23:56:47 +00:00
|
|
|
rd_title varchar(255) binary NOT NULL default '',
|
|
|
|
|
rd_interwiki varchar(32) default NULL,
|
|
|
|
|
rd_fragment varchar(255) binary default NULL
|
2007-04-22 14:04:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2006-10-25 07:26:59 +00:00
|
|
|
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/rd_ns_title ON /*_*/redirect (rd_namespace,rd_title,rd_from);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
|
|
|
|
|
2006-10-25 14:17:58 +00:00
|
|
|
-- Used for caching expensive grouped queries that need two links (for example double-redirects)
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/querycachetwo (
|
2006-10-25 14:17:58 +00:00
|
|
|
-- A key name, generally the base name of of the special page.
|
2007-06-22 18:31:24 +00:00
|
|
|
qcc_type varbinary(32) NOT NULL,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2006-10-25 14:17:58 +00:00
|
|
|
-- Some sort of stored value. Sizes, counts...
|
2009-01-15 06:56:58 +00:00
|
|
|
qcc_value int unsigned NOT NULL default 0,
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2006-10-25 14:17:58 +00:00
|
|
|
-- Target namespace+title
|
2009-01-15 06:56:58 +00:00
|
|
|
qcc_namespace int NOT NULL default 0,
|
2011-01-20 23:56:47 +00:00
|
|
|
qcc_title varchar(255) binary NOT NULL default '',
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2006-10-25 14:17:58 +00:00
|
|
|
-- Target namespace+title2
|
2009-01-15 06:56:58 +00:00
|
|
|
qcc_namespacetwo int NOT NULL default 0,
|
2011-01-20 23:56:47 +00:00
|
|
|
qcc_titletwo varchar(255) binary NOT NULL default ''
|
2009-01-15 06:56:58 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2006-10-25 14:17:58 +00:00
|
|
|
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE INDEX /*i*/qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value);
|
|
|
|
|
CREATE INDEX /*i*/qcc_title ON /*_*/querycachetwo (qcc_type,qcc_namespace,qcc_title);
|
|
|
|
|
CREATE INDEX /*i*/qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo);
|
2006-10-25 14:17:58 +00:00
|
|
|
|
|
|
|
|
|
2007-05-07 16:56:53 +00:00
|
|
|
-- Used for storing page restrictions (i.e. protection levels)
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/page_restrictions (
|
2013-11-18 18:47:53 +00:00
|
|
|
-- Field for an ID for this restrictions row (sort-key for Special:ProtectedPages)
|
|
|
|
|
pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2007-01-10 23:32:38 +00:00
|
|
|
-- Page to apply restrictions to (Foreign Key to page).
|
2007-06-22 18:31:24 +00:00
|
|
|
pr_page int NOT NULL,
|
2007-01-10 23:32:38 +00:00
|
|
|
-- The protection type (edit, move, etc)
|
2007-06-22 18:31:24 +00:00
|
|
|
pr_type varbinary(60) NOT NULL,
|
2007-01-10 23:32:38 +00:00
|
|
|
-- The protection level (Sysop, autoconfirmed, etc)
|
2007-06-22 18:31:24 +00:00
|
|
|
pr_level varbinary(60) NOT NULL,
|
2007-01-10 23:32:38 +00:00
|
|
|
-- Whether or not to cascade the protection down to pages transcluded.
|
2007-06-22 18:31:24 +00:00
|
|
|
pr_cascade tinyint NOT NULL,
|
2007-01-10 23:32:38 +00:00
|
|
|
-- Field for future support of per-user restriction.
|
2017-04-26 16:08:51 +00:00
|
|
|
pr_user int unsigned NULL,
|
2007-01-22 08:34:56 +00:00
|
|
|
-- Field for time-limited protection.
|
2013-11-18 18:47:53 +00:00
|
|
|
pr_expiry varbinary(14) NULL
|
2009-01-15 06:56:58 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2007-01-10 23:32:38 +00:00
|
|
|
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/pr_pagetype ON /*_*/page_restrictions (pr_page,pr_type);
|
2009-02-14 06:10:42 +00:00
|
|
|
CREATE INDEX /*i*/pr_typelevel ON /*_*/page_restrictions (pr_type,pr_level);
|
|
|
|
|
CREATE INDEX /*i*/pr_level ON /*_*/page_restrictions (pr_level);
|
|
|
|
|
CREATE INDEX /*i*/pr_cascade ON /*_*/page_restrictions (pr_cascade);
|
2007-01-10 23:32:38 +00:00
|
|
|
|
|
|
|
|
|
2007-12-11 09:51:56 +00:00
|
|
|
-- Protected titles - nonexistent pages that have been protected
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/protected_titles (
|
2007-12-13 18:16:43 +00:00
|
|
|
pt_namespace int NOT NULL,
|
2011-01-20 23:56:47 +00:00
|
|
|
pt_title varchar(255) binary NOT NULL,
|
2007-12-16 21:27:57 +00:00
|
|
|
pt_user int unsigned NOT NULL,
|
2017-06-06 17:39:14 +00:00
|
|
|
pt_reason varbinary(767) default '', -- Deprecated.
|
|
|
|
|
pt_reason_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that pt_reason should be used)
|
2007-12-11 14:09:26 +00:00
|
|
|
pt_timestamp binary(14) NOT NULL,
|
|
|
|
|
pt_expiry varbinary(14) NOT NULL default '',
|
2009-01-15 06:56:58 +00:00
|
|
|
pt_create_perm varbinary(60) NOT NULL
|
2007-12-11 14:09:26 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2007-12-11 09:51:56 +00:00
|
|
|
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/pt_namespace_title ON /*_*/protected_titles (pt_namespace,pt_title);
|
|
|
|
|
CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles (pt_timestamp);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
|
|
|
|
|
2008-02-20 08:53:12 +00:00
|
|
|
-- Name/value pairs indexed by page_id
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/page_props (
|
2008-02-20 08:53:12 +00:00
|
|
|
pp_page int NOT NULL,
|
|
|
|
|
pp_propname varbinary(60) NOT NULL,
|
2014-03-31 11:00:28 +00:00
|
|
|
pp_value blob NOT NULL,
|
|
|
|
|
pp_sortkey float DEFAULT NULL
|
2008-02-21 19:20:43 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
2008-02-20 08:53:12 +00:00
|
|
|
|
2009-01-19 13:56:08 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/pp_page_propname ON /*_*/page_props (pp_page,pp_propname);
|
2013-01-16 16:46:05 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/pp_propname_page ON /*_*/page_props (pp_propname,pp_page);
|
2014-03-31 11:00:28 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/pp_propname_sortkey_page ON /*_*/page_props (pp_propname,pp_sortkey,pp_page);
|
2009-01-15 06:56:58 +00:00
|
|
|
|
2008-03-18 00:06:06 +00:00
|
|
|
-- A table to log updates, one text key row per update.
|
2009-01-15 06:56:58 +00:00
|
|
|
CREATE TABLE /*_*/updatelog (
|
2011-01-20 23:56:47 +00:00
|
|
|
ul_key varchar(255) NOT NULL PRIMARY KEY,
|
2010-07-08 13:58:42 +00:00
|
|
|
ul_value blob
|
2008-03-18 00:06:06 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
2009-02-06 21:17:43 +00:00
|
|
|
|
2009-02-11 08:18:44 +00:00
|
|
|
-- A table to track tags for revisions, logs and recent changes.
|
2009-01-28 19:36:20 +00:00
|
|
|
CREATE TABLE /*_*/change_tag (
|
2016-08-13 01:06:33 +00:00
|
|
|
ct_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2009-10-21 02:46:39 +00:00
|
|
|
-- RCID for the change
|
|
|
|
|
ct_rc_id int NULL,
|
|
|
|
|
-- LOGID for the change
|
2017-04-26 16:08:51 +00:00
|
|
|
ct_log_id int unsigned NULL,
|
2009-10-21 02:46:39 +00:00
|
|
|
-- REVID for the change
|
2017-04-26 16:08:51 +00:00
|
|
|
ct_rev_id int unsigned NULL,
|
2009-10-21 02:46:39 +00:00
|
|
|
-- Tag applied
|
2011-01-20 23:56:47 +00:00
|
|
|
ct_tag varchar(255) NOT NULL,
|
2018-03-07 22:48:26 +00:00
|
|
|
-- Parameters for the tag; used by some extensions
|
2009-10-21 02:46:39 +00:00
|
|
|
ct_params blob NULL
|
2009-01-28 19:08:18 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
2009-02-06 21:17:43 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/change_tag_rc_tag ON /*_*/change_tag (ct_rc_id,ct_tag);
|
|
|
|
|
CREATE UNIQUE INDEX /*i*/change_tag_log_tag ON /*_*/change_tag (ct_log_id,ct_tag);
|
|
|
|
|
CREATE UNIQUE INDEX /*i*/change_tag_rev_tag ON /*_*/change_tag (ct_rev_id,ct_tag);
|
|
|
|
|
-- Covering index, so we can pull all the info only out of the index.
|
|
|
|
|
CREATE INDEX /*i*/change_tag_tag_id ON /*_*/change_tag (ct_tag,ct_rc_id,ct_rev_id,ct_log_id);
|
|
|
|
|
|
|
|
|
|
|
2009-04-27 17:15:01 +00:00
|
|
|
-- Rollup table to pull a LIST of tags simply without ugly GROUP_CONCAT
|
|
|
|
|
-- that only works on MySQL 4.1+
|
2009-01-28 19:08:18 +00:00
|
|
|
CREATE TABLE /*_*/tag_summary (
|
2016-08-13 01:06:33 +00:00
|
|
|
ts_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2010-12-04 03:20:14 +00:00
|
|
|
-- RCID for the change
|
2009-10-21 02:46:39 +00:00
|
|
|
ts_rc_id int NULL,
|
|
|
|
|
-- LOGID for the change
|
2017-04-26 16:08:51 +00:00
|
|
|
ts_log_id int unsigned NULL,
|
2009-10-21 02:46:39 +00:00
|
|
|
-- REVID for the change
|
2017-04-26 16:08:51 +00:00
|
|
|
ts_rev_id int unsigned NULL,
|
2009-10-21 02:46:39 +00:00
|
|
|
-- Comma-separated list of tags
|
|
|
|
|
ts_tags blob NOT NULL
|
2009-01-28 19:08:18 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
2009-02-06 21:17:43 +00:00
|
|
|
CREATE UNIQUE INDEX /*i*/tag_summary_rc_id ON /*_*/tag_summary (ts_rc_id);
|
|
|
|
|
CREATE UNIQUE INDEX /*i*/tag_summary_log_id ON /*_*/tag_summary (ts_log_id);
|
|
|
|
|
CREATE UNIQUE INDEX /*i*/tag_summary_rev_id ON /*_*/tag_summary (ts_rev_id);
|
|
|
|
|
|
|
|
|
|
|
2009-01-28 19:08:18 +00:00
|
|
|
CREATE TABLE /*_*/valid_tag (
|
2011-01-20 23:56:47 +00:00
|
|
|
vt_tag varchar(255) NOT NULL PRIMARY KEY
|
2009-01-28 19:08:18 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
* Introduced a new system for localisation caching. The system is based around fast fetches of individual messages, minimising memory overhead and startup time in the typical case. It handles both core messages (formerly in Language.php) and extension messages (formerly in MessageCache.php). Profiling indicates a significant win for average throughput.
* The serialized message cache, which would have been redundant, has been removed. Similar performance characteristics can be achieved with $wgLocalisationCacheConf['manualRecache'] = true;
* Added a maintenance script rebuildLocalisationCache.php for offline rebuilding of the localisation cache.
* Extension i18n files can now contain any of the variables which can be set in Messages*.php. It is possible, and recommended, to use this feature instead of the hooks for special page aliases and magic words.
* $wgExtensionAliasesFiles, LanguageGetMagic and LanguageGetSpecialPageAliases are retained for backwards compatibility. $wgMessageCache->addMessages() and related functions have been removed. wfLoadExtensionMessages() is a no-op and can continue to be called for b/c.
* Introduced $wgCacheDirectory as a default location for the various local caches that have accumulated. Suggested $IP/cache as a good place for it in the default LocalSettings.php and created this directory with a deny-all .htaccess.
* Patched Exception.php to avoid using the message cache when an exception is thrown from within LocalisationCache, since this tends to fail horribly.
* Removed Language::getLocalisationArray(), Language::loadLocalisation(), Language::load()
* Fixed FileDependency::__sleep()
* In Cdb.php, fixed newlines in debug messages
In MessageCache::get():
* Replaced calls to $wgContLang capitalisation functions with plain PHP functions, reducing the typical case from 99us to 93us. Message cache keys are already documented as being restricted to ASCII.
* Implemented a more efficient way to filter out bogus language codes, reducing the "foo/en" case from 430us to 101us
* Optimised wfRunHooks() in the typical do-nothing case, from ~30us to ~3us. This reduced MessageCache::get() typical case time from 93us to 38us.
* Removed hook MessageNotInMwNs to save an extra 3us per cache hit. Reimplemented the only user (LocalisationUpdate) using the new hook LocalisationCacheRecache.
2009-06-28 07:11:43 +00:00
|
|
|
-- Table for storing localisation data
|
|
|
|
|
CREATE TABLE /*_*/l10n_cache (
|
|
|
|
|
-- Language code
|
|
|
|
|
lc_lang varbinary(32) NOT NULL,
|
|
|
|
|
-- Cache key
|
2011-01-20 23:56:47 +00:00
|
|
|
lc_key varchar(255) NOT NULL,
|
* Introduced a new system for localisation caching. The system is based around fast fetches of individual messages, minimising memory overhead and startup time in the typical case. It handles both core messages (formerly in Language.php) and extension messages (formerly in MessageCache.php). Profiling indicates a significant win for average throughput.
* The serialized message cache, which would have been redundant, has been removed. Similar performance characteristics can be achieved with $wgLocalisationCacheConf['manualRecache'] = true;
* Added a maintenance script rebuildLocalisationCache.php for offline rebuilding of the localisation cache.
* Extension i18n files can now contain any of the variables which can be set in Messages*.php. It is possible, and recommended, to use this feature instead of the hooks for special page aliases and magic words.
* $wgExtensionAliasesFiles, LanguageGetMagic and LanguageGetSpecialPageAliases are retained for backwards compatibility. $wgMessageCache->addMessages() and related functions have been removed. wfLoadExtensionMessages() is a no-op and can continue to be called for b/c.
* Introduced $wgCacheDirectory as a default location for the various local caches that have accumulated. Suggested $IP/cache as a good place for it in the default LocalSettings.php and created this directory with a deny-all .htaccess.
* Patched Exception.php to avoid using the message cache when an exception is thrown from within LocalisationCache, since this tends to fail horribly.
* Removed Language::getLocalisationArray(), Language::loadLocalisation(), Language::load()
* Fixed FileDependency::__sleep()
* In Cdb.php, fixed newlines in debug messages
In MessageCache::get():
* Replaced calls to $wgContLang capitalisation functions with plain PHP functions, reducing the typical case from 99us to 93us. Message cache keys are already documented as being restricted to ASCII.
* Implemented a more efficient way to filter out bogus language codes, reducing the "foo/en" case from 430us to 101us
* Optimised wfRunHooks() in the typical do-nothing case, from ~30us to ~3us. This reduced MessageCache::get() typical case time from 93us to 38us.
* Removed hook MessageNotInMwNs to save an extra 3us per cache hit. Reimplemented the only user (LocalisationUpdate) using the new hook LocalisationCacheRecache.
2009-06-28 07:11:43 +00:00
|
|
|
-- Value
|
2016-10-28 14:33:32 +00:00
|
|
|
lc_value mediumblob NOT NULL,
|
|
|
|
|
PRIMARY KEY (lc_lang, lc_key)
|
2009-07-01 00:55:45 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
* Introduced a new system for localisation caching. The system is based around fast fetches of individual messages, minimising memory overhead and startup time in the typical case. It handles both core messages (formerly in Language.php) and extension messages (formerly in MessageCache.php). Profiling indicates a significant win for average throughput.
* The serialized message cache, which would have been redundant, has been removed. Similar performance characteristics can be achieved with $wgLocalisationCacheConf['manualRecache'] = true;
* Added a maintenance script rebuildLocalisationCache.php for offline rebuilding of the localisation cache.
* Extension i18n files can now contain any of the variables which can be set in Messages*.php. It is possible, and recommended, to use this feature instead of the hooks for special page aliases and magic words.
* $wgExtensionAliasesFiles, LanguageGetMagic and LanguageGetSpecialPageAliases are retained for backwards compatibility. $wgMessageCache->addMessages() and related functions have been removed. wfLoadExtensionMessages() is a no-op and can continue to be called for b/c.
* Introduced $wgCacheDirectory as a default location for the various local caches that have accumulated. Suggested $IP/cache as a good place for it in the default LocalSettings.php and created this directory with a deny-all .htaccess.
* Patched Exception.php to avoid using the message cache when an exception is thrown from within LocalisationCache, since this tends to fail horribly.
* Removed Language::getLocalisationArray(), Language::loadLocalisation(), Language::load()
* Fixed FileDependency::__sleep()
* In Cdb.php, fixed newlines in debug messages
In MessageCache::get():
* Replaced calls to $wgContLang capitalisation functions with plain PHP functions, reducing the typical case from 99us to 93us. Message cache keys are already documented as being restricted to ASCII.
* Implemented a more efficient way to filter out bogus language codes, reducing the "foo/en" case from 430us to 101us
* Optimised wfRunHooks() in the typical do-nothing case, from ~30us to ~3us. This reduced MessageCache::get() typical case time from 93us to 38us.
* Removed hook MessageNotInMwNs to save an extra 3us per cache hit. Reimplemented the only user (LocalisationUpdate) using the new hook LocalisationCacheRecache.
2009-06-28 07:11:43 +00:00
|
|
|
|
2012-02-15 22:42:09 +00:00
|
|
|
-- Table caching which local files a module depends on that aren't
|
|
|
|
|
-- registered directly, used for fast retrieval of file dependency.
|
2010-09-04 04:00:09 +00:00
|
|
|
-- Currently only used for tracking images that CSS depends on
|
|
|
|
|
CREATE TABLE /*_*/module_deps (
|
|
|
|
|
-- Module name
|
2010-11-05 22:15:58 +00:00
|
|
|
md_module varbinary(255) NOT NULL,
|
2015-09-30 00:15:57 +00:00
|
|
|
-- Module context vary (includes skin and language; called "md_skin" for legacy reasons)
|
2010-11-05 22:15:58 +00:00
|
|
|
md_skin varbinary(32) NOT NULL,
|
2010-09-04 04:00:09 +00:00
|
|
|
-- JSON blob with file dependencies
|
2017-08-04 12:43:50 +00:00
|
|
|
md_deps mediumblob NOT NULL,
|
|
|
|
|
PRIMARY KEY (md_module,md_skin)
|
2010-09-04 04:00:09 +00:00
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
2012-09-12 17:22:39 +00:00
|
|
|
-- Holds all the sites known to the wiki.
|
|
|
|
|
CREATE TABLE /*_*/sites (
|
2013-11-18 18:34:49 +00:00
|
|
|
-- Numeric id of the site
|
2012-09-12 17:22:39 +00:00
|
|
|
site_id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
|
|
|
|
|
|
|
|
-- Global identifier for the site, ie 'enwiktionary'
|
|
|
|
|
site_global_key varbinary(32) NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- Type of the site, ie 'mediawiki'
|
|
|
|
|
site_type varbinary(32) NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- Group of the site, ie 'wikipedia'
|
|
|
|
|
site_group varbinary(32) NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- Source of the site data, ie 'local', 'wikidata', 'my-magical-repo'
|
|
|
|
|
site_source varbinary(32) NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- Language code of the sites primary language.
|
|
|
|
|
site_language varbinary(32) NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- Protocol of the site, ie 'http://', 'irc://', '//'
|
|
|
|
|
-- This field is an index for lookups and is build from type specific data in site_data.
|
|
|
|
|
site_protocol varbinary(32) NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- 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.
|
|
|
|
|
site_domain VARCHAR(255) NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- Type dependent site data.
|
|
|
|
|
site_data BLOB NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- If site.tld/path/key:pageTitle should forward users to the page on
|
|
|
|
|
-- the actual site, where "key" is the local identifier.
|
|
|
|
|
site_forward bool NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- Type dependent site config.
|
|
|
|
|
-- For instance if template transclusion should be allowed if it's a MediaWiki.
|
|
|
|
|
site_config BLOB NOT NULL
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
|
|
|
|
CREATE UNIQUE INDEX /*i*/sites_global_key ON /*_*/sites (site_global_key);
|
|
|
|
|
CREATE INDEX /*i*/sites_type ON /*_*/sites (site_type);
|
|
|
|
|
CREATE INDEX /*i*/sites_group ON /*_*/sites (site_group);
|
|
|
|
|
CREATE INDEX /*i*/sites_source ON /*_*/sites (site_source);
|
|
|
|
|
CREATE INDEX /*i*/sites_language ON /*_*/sites (site_language);
|
|
|
|
|
CREATE INDEX /*i*/sites_protocol ON /*_*/sites (site_protocol);
|
|
|
|
|
CREATE INDEX /*i*/sites_domain ON /*_*/sites (site_domain);
|
|
|
|
|
CREATE INDEX /*i*/sites_forward ON /*_*/sites (site_forward);
|
|
|
|
|
|
|
|
|
|
-- Links local site identifiers to their corresponding site.
|
|
|
|
|
CREATE TABLE /*_*/site_identifiers (
|
|
|
|
|
-- Key on site.site_id
|
|
|
|
|
si_site INT UNSIGNED NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- local key type, ie 'interwiki' or 'langlink'
|
|
|
|
|
si_type varbinary(32) NOT NULL,
|
|
|
|
|
|
|
|
|
|
-- local key value, ie 'en' or 'wiktionary'
|
|
|
|
|
si_key varbinary(32) NOT NULL
|
|
|
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
|
|
|
|
|
|
CREATE UNIQUE INDEX /*i*/site_ids_type ON /*_*/site_identifiers (si_type, si_key);
|
|
|
|
|
CREATE INDEX /*i*/site_ids_site ON /*_*/site_identifiers (si_site);
|
|
|
|
|
CREATE INDEX /*i*/site_ids_key ON /*_*/site_identifiers (si_key);
|
|
|
|
|
|
2006-07-10 06:30:03 +00:00
|
|
|
-- vim: sw=2 sts=2 et
|