Commit graph

330 commits

Author SHA1 Message Date
MusikAnimal
865755dbe5 Create new table for watchlist expiry
This table will store expiries for watchlist items, so that pages can be
automatically unwatched at a specific time.

Bug: T240094
Change-Id: I014ffccb91969e7a222a83858c55e71067b0f2af
2020-02-07 14:59:50 -05:00
Brad Jorsch
9d67de01cb Postgres: Add PK to redirect table
Apparently when the PG schema was created, this PK was overlooked.

Change-Id: I208f03d7b3f768691905081244193bad4b789175
2019-11-27 08:24:49 +00:00
jenkins-bot
c2c789cc59 Merge "Remove traling double newlines from text files" 2019-11-07 10:01:02 +00:00
Timo Tijhof
0da1ecfd89 profiler: Remove ProfilerOutputDb and profileinfo.php entry point
Bug: T231366
Change-Id: I211c8192200d9af00914f9847608a6daf2898f91
2019-11-06 15:28:00 -05:00
Fomafix
d607ef8512 Remove traling double newlines from text files
Performed using:

git ls-files \*.json \*.php \*.xml \*.xsd \*.html \*.txt \*.sql | xargs sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba'

Excluded tests/parser/preprocess.

Change-Id: I513538ff13c942acfe589f15c5128a8df2b3ace9
2019-10-23 21:17:43 +02:00
Reedy
e22efbce17 Split down patch-actor-table.sql
Bug: T227662
Change-Id: I024ff1d6f4c2726242138ba7e7f19480d9d2b948
2019-09-30 15:20:08 +00:00
jenkins-bot
825d66bfa4 Merge "Split down patch-comment-table.sql" 2019-09-27 15:18:11 +00:00
Brad Jorsch
c29909e59f Mostly drop old pre-actor user schemas
This removes most of the pre-actor user and user_text columns, and the
$wgActorTableSchemaMigrationStage setting that used to determine
whether the columns were used.

rev_user and rev_user_text remain in the code, as on Wikimedia wikis the
revision table is too large to alter at this time. A future change will
combine that with the removal of rev_comment, rev_content_model, and
rev_content_format (and the addition of rev_comment_id and rev_actor).

ActorMigration's constructor continues to take a $stage parameter, and
continues to have the logic for handling it, for the benefit of
extensions that might need their own migration process. Code using
ActorMigration for accessing the core fields should be updated to use
the new actor fields directly. That will be done for in a followup.

Bug: T188327
Change-Id: Id35544b879af1cd708f3efd303fce8d9a1b9eb02
2019-09-09 11:38:36 -04:00
Reedy
c00c34f288 Split down patch-comment-table.sql
Bug: T227662
Change-Id: I7617616df57f7468d06e9b52426b6851bfef0e7d
2019-08-20 19:35:57 +00:00
Brad Jorsch
0abb9338f8 Mostly drop old comment schemas
This removes most of the pre-CommentStore text columns, and the
$wgCommentTableSchemaMigrationStage setting that used to determine
whether the columns were used.

rev_comment remains in the code, as on Wikimedia wikis the revision
table is too large to alter at this time. A future change will combine
that with the removal of rev_user_text, rev_content_model, and
rev_content_format (and the addition of rev_comment_id and rev_actor).

CommentStore's constructor continues to take a $stage parameter, and
continues to have the logic for handling it, for the benefit of
extensions that might need their own migration process.

Bug: T166733
Change-Id: I1479c73774e01ead1490adf6128f820c09bce9d4
2019-02-07 16:59:27 +11:00
Amir Sarabadani
8640b66568 Clean ups of dropping tag_summary table
Change-Id: I92dc906d0dfd870e6b77671e5d7cfd3f56090325
2018-12-19 10:14:33 +00:00
Amir Sarabadani
2ce92e90a7 Drop tag_summary and valid_tag tables
Bug: T209525
Change-Id: I153607239145a772f5ea47eefd3340096a494b4b
2018-12-18 20:45:36 +00:00
Kevin Israel
ba1207d5d5 PostgreSQL: Drop three unused columns
The columns dropped in this commit are:

* category.cat_hidden
  (for MySQL, dropped in 1.20 / 0cbc85494d)
* site_stats.ss_admins
  (for MySQL, dropped in 1.21 / bd602d2083)
* recentchanges.rc_cur_time
  (for MySQL, dropped in 1.24 / 2b441eba40)

Bug: T64103
Change-Id: I7a7e9a2ac5066a9c9ab2583419d507e14fdd8c2c
2018-12-14 13:01:48 -05:00
Amir Sarabadani
1427bb1821 Drop ct_tag column from change_tag table
Bug: T194163
Change-Id: I05d43510b51a67733b0107f0a768e261fe8ddabd
2018-11-28 23:03:43 +01:00
Brad Jorsch
d099bb6f95 Drop the image_comment_temp table
It is no longer used.

Bug: T188132
Change-Id: Ic8efeddc030f48e82ba861926121b64eca37d169
2018-11-14 15:04:31 -05:00
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
Reedy
cf95107ffa Fix table prefixing in patch-change_tag-change_tag_rc_tag_id.sql
Change-Id: Id1963e93a43d4b183a31788b645c83e3037f3016
Follows-up: I24609c57e47308d1330a97527f4ea374d0d307ba
2018-09-06 22:41:27 +01: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
Reedy
267d99fa85 Convert numerous UNIQUE INDEX to PRIMARY KEY
MySQL, SQLite, PostgreSQL and MSSQL done with transitional patches.

One additional duplicate index removed from PostgreSQL schema.

Having a PK is essential to do maintenance, specially on large tasks.
By not having a PK it is impossible to add it in a safe way if not done
directly on the master.

Having a PK means that we can easily change the PK into another one if
needed in the future. The ones we chose might not be the best ones, but
will allow us to get them changed.

Bug: T198811
Change-Id: I6b96a427687085c6c24bcd759c9739f81288b919
2018-07-11 20:36:33 +01:00
Reedy
b2101d7202 Rename index type_action to log_type_action
Bug: T51199
Change-Id: I697fd5689e573bfa965ca75385f919c9a8403c14
2018-07-11 19:07:21 +00: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
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
Brad Jorsch
7e685a395d Fix typo in postgres patch-drop-ar_text.sql
Change-Id: I6d479d123848325b8501275ef4b98fc81cd99505
2018-04-26 14:52:12 -04:00
jenkins-bot
2224e31507 Merge "Drop archive.ar_text and ar_flags" 2018-04-23 20:15:26 +00:00
Brad Jorsch
6318430fc8 PostgreSQL: Set owners for sequences
PostgreSQL allows setting an "owner" column for a sequence, so if that
column is dropped then the sequence will be dropped too. We should
certainly take advantage of that when creating duplicate tables for unit
testing (particularly when $temporary is false), and we may as well do
it for our permanent tables too.

Change-Id: I4822ac33298e3f3ef59f4372a24aa0866a6e66ae
2018-04-09 12:05:29 -04:00
Brad Jorsch
cc0473766a rdbms: Remove support for PostgreSQL < 9.2, and improve INSERT IGNORE for 9.5
MediaWiki doesn't support PostgreSQL < 9.2, so drop the support for
older versions.

At the same time, since we're messing with the DatabasePostgres::insert()
code anyway, let's start using ON CONFLICT DO NOTHING for PG >= 9.5.

And since we're doing that, let's do the same for
DatabasePostgres::nativeInsertSelect().

Change-Id: I7bf13c3272917ebafeaff11eb116714a099afdf3
2018-04-05 20:52:46 +00: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
Brad Jorsch
21c6ae1163 Drop archive.ar_text and ar_flags
This should have been done long ago. Now it is being done.

This also changes ar_text_id to NOT NULL, since it should never be null
anymore, and DEFAULT 0 in preparation for MCR stopping writing it.

Bug: T33223
Change-Id: I18f1c740b7537c7dc3cfeba9b241d0a9f31caa34
2018-04-03 12:54:27 -04: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
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
jenkins-bot
8e0d293406 Merge "Add ip_changes to postgres/tables.sql" 2017-11-29 21:29:22 +00:00
Reedy
70951d1971 Add ip_changes to postgres/tables.sql
Follow-up Ic11c64813ee04e8520771bfa156f8e51404273e7

Bug: T177258
Change-Id: I69a278c1928ed91ef5cbe5b66e590eef629a2981
2017-11-29 21:21:57 +00:00
Reedy
47c378bb68 Remove DEFAULT '' from postgres ip_changes.ipc_rev_timestamp
Follows-up Ic11c64813ee04e8520771bfa156f8e51404273e7

Bug: T181672
Change-Id: I58fe5edb1e7656773271634f702ed044c6036497
2017-11-29 20:11:19 +00:00
MusikAnimal
70a602dde4 Add SQL for postgres, and fail gracefully in populateIpChanges
If the ip_changes table doesn't exist, the populateIpChanges maintenance
script will fail gracefully, throwing a descriptive error.

The postgres SQL is untested.

Bug: T177258
Change-Id: Ic11c64813ee04e8520771bfa156f8e51404273e7
2017-11-29 00:52:49 +00: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
5ba7fb251e Fix PostgreSQL patch-add-3d.sql by replacing it
Follows-up 6260545fee, a2f5d05ae8. (T157348)

If updates are run for the first time on an installation that already
has '3D' in the enum (e.g. because it's a fresh install), the update
fails.

Instead of blindly running a patch file, we instead add a method that
checks whether the enum type already contains the value before adding
it.

Bug: T177417
Change-Id: Iad10cb88cf1cb35cfb95ce98a556b33688158a88
2017-10-12 03:24:56 +00:00
Brad Jorsch
91b86399b1 Fix various PostgreSQL failures
* Fix schema for image_comment_temp.
* Provide values in CommentStoreTest::provideInsertRoundTrip() for
  columns where the PG schema doesn't have a default value but the MySQL
  schema does.
* Call nextSequenceValue() from CommentStoreTest::testInsertRoundTrip().
* Correctly handle $options being the string 'FOR UPDATE' in
  DatabasePostgres::selectSQLText()
* Correctly handle the initial table in DatabasePostgres::selectSQLText() FOR
  UPDATE mangling.
* Correctly handle aliases in DatabasePostgres::selectSQLText() FOR
  UPDATE mangling.

Tests in PG are still going to be broken thanks to the fact that
nextSequenceValue() and insertId() can't be separated by another
nextSequenceValue()/insertId() pair. That should be taken care of by
T164898/T164900.

Change-Id: Ia770a003ca9170ab8bcc1436d8afe30700e00ada
2017-08-30 17:18:29 -04:00
Brad Jorsch
08a09b77d5 Fix index in PostgreSQL schema
Followup to Ic3a434c06

Change-Id: I68966726f91b1854e845b2a0757b599644749b4f
2017-08-30 12:28:24 -04:00
Brad Jorsch
11cf01dd9a Add comment table and code to start using it
A subsequent patch will remove the old columns.

Bug: T166732
Change-Id: Ic3a434c061ed6e443ea072bc62dda09acbeeed7f
2017-08-30 15:05:00 +10:00
Matthias Mullie
6260545fee Follow-up to '3D' file type addition
Based on feedback on Id78a504302fa664b353a4c45bdc5d99f95a0180a

Bug: T157348
Change-Id: Id6bfe8d20307f62e4673a5ef30e79f164b1ea034
2017-07-28 23:46:33 +00:00