Commit graph

94 commits

Author SHA1 Message Date
David Barratt
c2bd4b12c7 Make Schema changes for Partial Blocks
Update the database schema so a block can be switched between a sitewide and
partial block. Also add the restrictions table for specifiying the partial
blocks.

Bug: T197144
Change-Id: I4a725312c4b980a1b14e5ca826069fa2278a5913
2018-09-07 15:25:49 -07:00
Amir Sarabadani
da9d5c2188 Schema change for reading ct_tag_id instead of ct_tag
Adding unique index on ct_tag_id and making indexes on ct_tag non unique

Bug: T193874
Change-Id: I24609c57e47308d1330a97527f4ea374d0d307ba
2018-09-04 19:29:48 +02:00
Aaron Schulz
27a2aceb25 Drop the transcache table from the schema
Bug: T189702
Change-Id: I3286a99165953392126fcff07d565738863de6a1
2018-08-31 19:50:49 -07:00
Amir Sarabadani
ddd47d2808 Add index on rc_this_oldid
Approved by TechComm

Bug: T139012
Change-Id: I0ccfd26d68a5ceef552ae3aa37a6e345b24ff84e
2018-08-02 21:46:54 +02:00
Brad Jorsch
d5713fc655 Run populateContentTables.php from update.php
Since update.php will eventually be dropping the old columns and fields,
we should make sure the migration script gets run first.

Bug: T197818
Change-Id: I47f5ba4e21b4fe2ef0beb9fc83896cd4b0a0d505
2018-07-10 13:13:26 -04:00
Brad Jorsch
c84083e413 Make archive.ar_rev_id unique
To follow up I39b0825c, this change replaces the existing non-unique
index on the column with a unique index, to help avoid some of these
sort of bugs in the future.

Bug: T193180
Change-Id: I932478c9c6a13210bc9dff75286d0f08da56682c
2018-06-04 08:52:06 +00:00
Amir Sarabadani
f45314cd4f Add ct_tag_id field to change_tag table
Part of normalizing the table

Bug: T193867
Change-Id: I8c38e673aab14c5b87e5501da1a752c5bd4709c8
2018-05-18 16:37:04 +02:00
Brad Jorsch
1c7bf1baf0
Deduplicate archive.ar_rev_id
Old bugs and such may have left the archive table with multiple rows
using the same ar_rev_id, or rows that also exist in the revision table.
These need to be cleaned up for MCR.

The maintenance script added here will delete rows that appear to be
duplicates of the same change, and will assign new IDs to rows that do
not appear to be duplicates.

Bug: T193180
Change-Id: I39b0825c9469e074ded3df33a4f06a1ef0edb494
2018-05-16 14:34:11 +02:00
Brad Jorsch
aef72c5cf6 Populate externallinks.el_index_60 and drop default
Adds a maintenance script to populate the field, has that be
automatically run during update.php, and drops the no-longer-needed
default value on the column (where possible: mssql has some sort of
constraint thing going on that I have no idea how it works).

Bug: T59176
Change-Id: I971edf013a1a39466aca3b6e34c915cb24fd3aa7
2018-05-15 12:08:35 -04:00
Amir Sarabadani
6039593649 Introduce change_tag_def table
Table defining tag names for IDs. Also stores hit counts to avoid expensive queries on change_tag
See T185355 for more information

Bug: T193867
Bug: T185355
Change-Id: I4fd943589b3ed304471304c8beda15327a8edbcf
2018-05-08 18:48:52 +02:00
Amir Sarabadani
f303a13a72 Change index on rc_namespace, rc_title to rc_namespace, rc_title, rc_timestamp
Bug: T190444
Change-Id: I5c59f1ee9306710505654a8db965f85ebf855873
2018-04-04 09:08:28 +02:00
jenkins-bot
1a9ba829a5 Merge "Populate ar_rev_id and make it non-nullable" 2018-04-03 15:37:05 +00:00
jenkins-bot
dd942172f8 Merge "DB: Add img_description_id column" 2018-04-03 01:18:42 +00:00
Brad Jorsch
f78faf4566 Populate ar_rev_id and make it non-nullable
Revisions deleted before MediaWiki 1.5 do not have a value in this
field. This is going to be a problem for migration to the MCR schema, so
provide a maintenance script to clean this up.

Then, for good measure, change the schema to make the field
non-nullable.

Bug: T182678
Change-Id: Ie2e11f12a30f379db32c3e074658012c6f93adb0
2018-04-02 13:08:55 -04:00
Eddie Greiner-Petter
27c76fa4ae Overhaul site_stats table
The site stats table holds a bunch of metric fields, two of which are of
data type "bigint unsigned", 3 are "bigint" (signed) and one is int
(signed).  Also the default values differ widely: It is 0 on the
"unsigned" fields and the "int" field, but -1 on the three others. This
patch makes all of this more consistent:

Set all fields (except the ss_row_id, which isn't changed) data type to
"bigint unsigned". Also set NULL as the default value for all those
fields. Obviously -1 isn't a possible default value any more. Also, 0
can easily be mistaken for a real value (e.g. ss_active_users=0 -->
"there is nobody active on this wiki"). NULL, by it's definition, is the
value of choice for a value to insert into fields of which we don't know
a correct value.

The respective patch files were tested locally against MySql, Sqlite,
Postgres and SQL Server 2016. Neither oracle nor the upgrade with
update.php was tested.

Bug: T56888
Change-Id: I7d42aae434852a56b6f8dd559d8a5f3bce416021
2018-03-26 23:51:40 +00:00
daniel
b0bdfd7e9f MCR: replace slot_inherited with slot_origin
Bug: T189004
Change-Id: Ie9dbda3296a71f584c82a5f275098adc225a53d5
2018-03-19 21:51:56 +01:00
Brad Jorsch
267af09d32 DB: Add img_description_id column
This begins the process of merging image_comment_temp into the image
table by adding the needed column. Iab5f5215 will adjust the code
to use it and to add the necessary migration script.

Note this patch puts the new schema change in the 1.30 section rather
than the 1.31 section. This allows Iab5f5215 to have migrateComments.php
migrate the comments directly to the new field instead of having to
populate and then depopulate the temporary table.

Bug: T188132
Change-Id: I2485c5a758bf03bb2b4991eea920abd9d0d30bda
2018-03-13 16:54:25 -04:00
Brad Jorsch
27c61fb1e9 Add actor table and code to start using it
Storing the user name or IP in every row in large tables like revision
and logging takes up space and makes operations on these tables slower.
This patch begins the process of moving those into one "actor" table
which other tables can reference with a single integer field.

A subsequent patch will remove the old columns.

Bug: T167246
Depends-On: I9293fd6e0f958d87e52965de925046f1bb8f8a50
Change-Id: I8d825eb02c69cc66d90bd41325133fd3f99f0226
2018-02-23 10:06:20 -08:00
Brad Jorsch
0c0f70a326 Non-MySQL comment table updates
Follows up Ic3a434c06.

Add schema for MSSQL and Oracle, and add a missing 'migrateComments'
call for PostgreSQL.

Bug: T166732
Change-Id: I408085db17bf951ce721427e7344b4afd5706e40
2018-01-17 12:45:36 -05:00
Brad Jorsch
295b055ea3 Migrate ar_text to modern storage
This really should have been done a very long time ago.

This adds a maintenance script to migrate rows with ar_text_id null to
modern storage, either the text table or ExternalStore.

Bug: T36925
Change-Id: I5608c6b6d3ecad516b785e13d668427c1b762e41
2018-01-09 16:15:44 -05:00
daniel
943c724198 MCR database schema
Schema additions/updates for MySQL, SQLite, PostgreSQL, MSSQL
and Oracle to add new tables:

* content
* content_models
* slots
* slot_roles

See also https://www.mediawiki.org/wiki/Multi-Content_Revisions/Database_Schema

Bug: T174028
Change-Id: I30a3a9834d54d0e6957553d91908b2b73b2c802f
2017-12-23 17:43:09 -05:00
Eddie Greiner-Petter
49f7be39e1 Add primary keys to site_stats
As discussed in I7d42aae434852a56b6f8dd559d8a5f3bce416021 primary keys
are needed to perform various schema changes on  the site_stats table.
This patch aims to introduce primary keys for all supported dbms.

The respective *.sql patch files were tested locally against Postgres
and SQL Server 2016. Please note that neither the patch file for Oracle
DB nor the mediawiki upgrade through update.php was tested.

Bug: T56888
Change-Id: Id10e221f0dc120bc09afc22596fd1dbecbf6a61d
2017-10-17 11:59:20 +00:00
Brad Jorsch
0a9c55bfd3 Deprecate IDatabase::nextSequenceValue()
It's often forgotten because MySQL and Sqlite don't use it, the only
users are PostgreSQL and Oracle. And when used, if inserts to multiple
tables are being done it's easy to get the ordering wrong.

This patch reimplements DatabasePostgres::insertId() in terms of PG's
lastval() function, and adds triggers to the Oracle schema to make it
work the same as the other databases.

Bug: T164900
Change-Id: Ib308190c52673a9266c8495a589ae644f9fbefce
2017-08-31 11:16:26 -04:00
addshore
1236f24ec3 Add array typehint to 2 DatabaseUpdater methods
Change-Id: I29abd4525b46e9b47cf3933e5fcb791fd6ea3fb5
2017-03-15 13:50:27 +00:00
This, that and the other
73224f4f8b 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-27 09:24:20 +00:00
Brad Jorsch
c585ec5ed6 Add externallinks.el_index_60 column and indexes
This will allow for replacing the limit-and-offset queries with queries
that page in a sensible manner.

Bug: T59176
Change-Id: If5c137f68496772f3fff3a735b7b0c388426e518
2016-11-21 16:37:49 -05:00
This, that and the other
d0a0e9b417 Add primary key to change_tag and tag_summary tables
Based heavily on 43e386ca16.

Bug: T123225
Change-Id: I33480f4016812259700979f1145099744bb451d4
2016-10-02 13:02:41 +11:00
Brad Jorsch
adf9875c74 Add rc_name_type_patrolled_timestamp index
Bug: T140108
Change-Id: I382a5f0daef703a3d16fe008a5e1d1402f2c7b33
2016-07-14 12:01:04 -04:00
addshore
43e386ca16 Add id field to watchlist db table
Bug: T125990
Change-Id: I3ce3a736d51bc06fe40fd773f079e694039b4f3e
2016-02-18 21:01:01 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Timo Tijhof
baf1721491 resourceloader: Remove obsolete msg_resource database table
No longer used as of 5d5b269e0e.

Change-Id: Ieb8448185cf39aa396e902e025e673f0886ac3c3
2015-12-14 01:24:27 +00:00
Timo Tijhof
cbf5bacae5 resourceloader: Remove obsolete msg_resource_links table
No longer used as of Ia9131f570.

Change-Id: If009e2620e59002e127d21b90a96bdd29e5d2a9d
2015-12-14 01:23:19 +00:00
umherirrender
abeedb102c Add version comments to DatabaseUpdater for 1.25
There are already version comments for the older versions, so also
adding comments for the current version to make it easier finding the
corresponding version when looking at database changes.

As suggested in Ieeb558f9523c11965cbc1941cad4f316c00c85c5

Change-Id: Idf4f52aec4eeb73ec2f830d7d7eaab84c73b6d95
2015-01-09 22:17:52 +01:00
Chad Horohoe
5f8edb2c0a Drop ss_total_views and page_counter fields from MediaWiki
Follows up removal of code using hitcounters in 90d90dad6

RFC: https://www.mediawiki.org/wiki/Requests_for_comment/Removing_hit_counters_from_MediaWiki_core
Change-Id: Ieeb558f9523c11965cbc1941cad4f316c00c85c5
2015-01-09 19:01:01 +00:00
Kunal Grover
50144cd02a First version of Page Language selector
Special page PageLanguage to set the page language of a page.
To enable the feature, set $wgPageLanguageUseDB to true
and assign the 'pagelang' user right to a user group.

Bug: 35489
Change-Id: I0f82b146fbe948f917c1c5d29f7469644d797e80
2014-06-27 23:27:07 +00:00
umherirrender
544c369369 Standardize version comment in OracleUpdater.php
All updaters have a space between // and version number, do this also
for oracle updater

Change-Id: I0f44bd5d1ab5e131cca3cd7ebfaaf1fe91e4d9d8
2014-06-27 20:05:00 +00:00
jenkins-bot
2e040b99ed Merge "Fix Oracle 1.23 missing patches (rebase)" 2014-05-09 11:29:31 +00:00
umherirrender
f89628e1b1 Add version comments for 1.24 to all updaters
pp_sortkey was added with I217c42656fb877ff35a36eb446a22bdaf119faac,
which is part of 1.24, so adding the comment before that.

Change-Id: I7b970705ad7de75cb9542f8a5a963697386940a7
2014-05-05 18:50:02 +00:00
umherirrender
f5f1e38b9a Fixed some @params documentation (includes/[db|installer])
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I3595e9aac69ac42fbb74b0783fae0ad9bcc831aa
2014-04-19 13:55:27 +02:00
freakolowsky
78922b9877 Fix Oracle 1.23 missing patches
(rebase)

also fixed wrong definition of password expire filed
DEFAULT was unnecessary and faulty (has to be before
NULLABLE clause)
and changed the null-user insert

Change-Id: Ia91ed19bd4e3380f396ef895745dbd2014e1eb8b
2014-03-04 10:13:24 +01:00
csteipp
dbba0afd38 Add Updater for Oracle
Bug: 61015
Change-Id: I748d7531be90155d8b99472d3459e46ce4855f07
2014-03-03 13:31:25 -08:00
Siebrand Mazeland
f077c4b1d6 Update formatting
Change-Id: I18aff576262479c9bb1c56eb8e1d1aaae200e4b1
2014-02-06 09:27:05 +01:00
Jackmcbarn
65a304c444 Add index on logging.log_user_text
Fixing bug #54404 requires querying against logging.log_user_text, which
is currently unindexed. Add an index, to prevent performance from being
adversely affected by the fix.

Bug: 54432
Change-Id: I6b2af65c75bbee57377cb1ec2e75ea41a5091f80
2013-12-19 03:13:05 +00:00
Mark A. Hershberger
08d3afc971 Disable $wgContentHandlerUseDB during upgrade where fields don't exist.
They can cause problems if, for example, the installation has hooks
for UserSaveSettings or UserSaveOptions that try to update a user page.

Change-Id: I31078678e8939c897b1357bcb77eb2d26f806f29
Bug: 47271
2013-11-01 18:26:21 +00:00
Siebrand Mazeland
bb0044f638 Address PHP CodeSniffer errors and warnings
One class of errors left unaddressed: Class name "WebInstaller_Language"
is not in camel caps format. I think this can be changed, too, but I
wasn't able to quickly find out where class names are being created.

Change-Id: I920b0231db1b70b68c6c8907257c288a0e112668
2013-10-23 12:42:07 +00:00
tisane
9b2b027ba7 Add archive, externallinks PK
* New fields: ar_id, el_id. el_id is presently not used for
  anything, but will help with online schema changes.

Bug: 15441
Bug: 39675
Change-Id: Ib6b0fc3736d173fa4ba7b786ecfc710b2f4711bb
2013-10-17 18:43:40 +01:00
Siebrand Mazeland
626addab9e Update formatting
With some manual corrections.

Change-Id: Icd947288c32fdb90a0f35388963ef5a17ffa58e7
2013-10-09 09:35:18 +00:00
freakolowsky
2269df8e76 Fixed OracleUpdater::doPageRestrictionsPKUKFix prefix
Previously OracleUpdater::doPageRestrictionsPKUKFix had the
database prefix hard-coded into the SQL query. This removes
the hard-coded value and replaces it with the actual configured
prefix.

Change-Id: If60f23af7fd238d4c91ebf25b095749345a2718d
2013-05-29 20:06:42 +00:00
umherirrender
15abcf71ca Added/Removed spaces around string concatenation
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !

Fixed windows newline style

Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
2013-04-13 13:36:24 +02:00
umherirrender
48cd72819e fix some spacing
Change-Id: Ia9650be8b791fd2f0ccbc099436918a9d12d9968
2013-02-04 20:04:26 +00:00