Commit graph

305 commits

Author SHA1 Message Date
Umherirrender
1d178e177b Remove unneeded continue/return statements
Change-Id: I26f9845b09ecc15de8b6e0213ab369b386194c9d
2021-08-17 22:53:53 +02:00
jenkins-bot
170f5c21a6 Merge "Rename change_tag indexes to have ct_ prefix" 2021-06-08 17:50:09 +00:00
Ammar Abdulhamid
1adaca51c3 Rename change_tag indexes to have ct_ prefix
Bug: T270033
Change-Id: I8a429726c99f6cadea0d671fd871f66b5611c856
2021-06-08 17:57:15 +01:00
DannyS712
a84ad7bd40 Add some missing __METHOD__ parameters to database calls
Plus fix a typo

Change-Id: I8ca326990559ea80254ce0cef2ed204590716679
2021-06-07 19:28:51 +00:00
Ammarpad
a8c01d7726 Rename name_title index to have page_ prefix
Bug: T270033
Change-Id: Id70d0e0a37dd0d000079820d51cef2791f5ec42e
2021-06-05 20:21:07 +02:00
Amir Sarabadani
7fdca7ce51 Add index on oldimage.oi_timestamp
Mirroring what happens on image table.

Bug: T279982
Change-Id: Ib67c32b10d3b88e09514d8fbb5dcb4f977108ba2
2021-05-29 20:44:32 +02:00
Amir Sarabadani
4444264dfe Fix name of searchindex table in PostgresUpdater
Follow up to I9f33132676344f8cd8

Change-Id: I365e0fa2a8cc7c00d67572e108f892b95094d199
2021-05-28 12:40:44 +02:00
Amir Sarabadani
acd5076099 Migrate searchindex to abstract schema
For MySQL/Sqlite:
 - Nothing

For Postgres:
 - Introduce the table. It's not used but it'll be used in the future (T220450)

Bug: T164898
Bug: T230428
Bug: T220450
Change-Id: I9f33132676344f8cd813f7a438b3a6a078fd281c
2021-05-27 15:01:24 +02:00
Ammarpad
5954b380fc Migrate revision table to abstract schema
Postgres:
 - Drop foreign key from rev_page
 - Make rev_page not nullable
 - Change rev_comment_id from int to bigint
 - Change rev_actor from int to bigint
 - Sync rev_page_id index with MySQL

MySQL/SQlite:
 - Drop default from rev_timestamp

Additional changes in the generator script to handle more
formatting issues due to use of additional custom table options

Bug: T230428
Bug: T164898
Change-Id: Ia07dd52e43123473a1728523a3f863280537db8e
2021-05-20 14:52:15 -07:00
Aaron Schulz
12923c1cd5 objectcache: add last-modified token field to objectcache table
Also added token and flags fields. The token field can
be used as a tie-breaker for modtime and also for faster
cas() operations. The flags field makes serialization and
compression format changes easier in the future.

Bug: T274174
Change-Id: I45731a877b21835652993c2d285165a76eeae3e9
2021-05-18 20:06:37 -07:00
Ammarpad
f100eb3b2a PostgresUpdater: Drop updateUserTableSequence function
Bug: T164898
Change-Id: I16c5548eb4f67509182ca4da5daf47ac6c0c4a9d
2021-05-17 22:38:19 +01:00
Ammarpad
82d2675ae6 PostgresUpdater: Simplify working with constraints
Change-Id: I05d42fcd25c952617f7ec3b92e1bfb32ff8513c5
2021-04-26 15:19:44 +01:00
Ammarpad
88bfadf5ed Migrate user table to abstract schema
Postgres:
 - Rename the table from `mwuser` to `user`
 - Transition user_id from int to serial
 - Make user_token not nullable and add default
 - Make user_real_name not nullable and add default
 - Make user_email not nullable
 - Make user_newpassword not nullable
 - Make user_password not nullable
 - Drop UNIQUE contraint on user_name and add default

MySQL/SQLite:
 * No changes

Bug: T164898
Bug: T230428
Change-Id: I746714f7b3ae16f9625f97bcca84280fcd8b61a0
2021-04-24 21:44:26 +01:00
Amir Sarabadani
4acdf1669d Final fixes of Postgres updater for REL1_36
Tested upgrade from 1.35 locally, and it broke due to two issues:
 - text table didn't exist, making renaming the table the first update.
 - the update was using user instead of mwuser. That was intentional on
   the grounds that it'll be fixed soon, but it seems I746714f7b3a is
   not going to make to the release.

Bug: T164898
Change-Id: I0c152f339954a001c5a5a0b94b8ad48e5b077290
2021-04-10 19:37:55 +00:00
jenkins-bot
3f96a72ac9 Merge "Prepare for migrating user to abstract schema" 2021-03-28 10:31:03 +00:00
Ammarpad
c697406d3f Prepare for migrating user to abstract schema
Split off to make the migration patch smaller

Postgres:
 - Make user_touched not nullable

MySQL/SQlite
 - Change user_name from varchar to varbinary
 - Change user_name from varchar to varbinary
 - Drop empty string default from user_touched (Timestamp field)

Bug: T230428
Bug: T164898
Change-Id: I8fe0b1fb2af3149a2e2fdae7bb056ac6f863b09c
2021-03-28 09:55:07 +01:00
Ammarpad
eece54b831 Remove unused schema change.
There's no reason to keep schema change that's no longer useful.
History is already tracked by git.

Change-Id: Ia8aa0d21ae5f2d799d9a641ebe7b924f56e07ab1
2021-03-27 09:32:29 +01:00
jenkins-bot
1857b8244b Merge "Drop rest of unsupported upgrade paths and patches in Postgres" 2021-03-26 19:04:53 +00:00
jenkins-bot
35657bca57 Merge "Move updates around in Postgres to make it sequential" 2021-03-26 19:04:45 +00:00
jenkins-bot
d904a7159b Merge "Drop tsearch fixes in postgres" 2021-03-26 19:04:18 +00:00
jenkins-bot
6ce397faf5 Merge "Fix several issues in upgrading from 1.35 to master in Postgres" 2021-03-23 22:48:45 +00:00
Amir Sarabadani
4168c88d6a Fix several issues in upgrading from 1.35 to master in Postgres
- Currently the updater just spams with
Changing column type of 'archive.ar_actor' from 'bigint' to 'BIGINT'

The strtolower reduces this spam.

 - Remove dropping the old index and constraint that is already handled
   in line above.
 - Remove adding an index on image table that was added twice by mistake
   and this one actually is on wrong fields which breaks.

Change-Id: Iae3f90f71519b4bdbdf8f26b623c817e5b45164b
2021-03-22 11:56:42 +01:00
Amir Sarabadani
6ba7c4fa09 Drop rest of unsupported upgrade paths and patches in Postgres
These are from versions we don't support direct upgrade anymore and they
are already removed from update.php wiring.

Bug: T272199
Change-Id: I863d91d7d620943571cb8bb22f663c2efbbd0821
2021-03-22 07:43:34 +01:00
Amir Sarabadani
b4033cb3c4 Move updates around in Postgres to make it sequential
It was only one update left after cleaning up unsupported upgrades.

Change-Id: Id9a86e1f296b71513197bb3c8302c8ca5215d0cc
2021-03-22 07:35:45 +01:00
Amir Sarabadani
447db80038 Drop tsearch fixes in postgres
These changes to tsearch functions were introduced in 2010 in a version
that we definitely don't support direct upgrades from.

Bug: T272199
Change-Id: I47c4054552daad55c0e13eec36865706ee6d1903
2021-03-22 07:29:06 +01:00
Amir Sarabadani
e2c005f91f Drop unsupported 1.23 upgrade code and patches from Postgres
We don't support upgrading from 1.23 anymore.

Bug: T272199
Change-Id: Iac9652095927c86c47f45a2aa131c28efef5c73a
2021-03-22 07:26:53 +01:00
Ammarpad
53f24f2ac8 Postgres: Fix revision table indexes drifts with MySQL
Added new index: 'rev_page_timestamp' (the corresponding index
in MySQL is currently 'page_timestamp' but it will soon be
renamed to have the rev_ suffix as part of T270033).

Rename rev_timestamp_idx and revision_unique to match names
that are in use for MySQL

Bug: T230428
Bug: T164898
Change-Id: I3a79a892673b073cea57ee4e397b2963c7cef2f1
2021-03-21 18:29:12 +01:00
Ammar Abdulhamid
6a3aa5b5a2 Migrate page to abstract schema
Postgres:
 - Change page_namespace from smallint to int
 - Change page_random from numeric with arbitrary precision to float
 - Make page_touched not nullable

MySQL/SQLite:
 - Change datatype of page_title from varchar (with binary collation)
   to varbinary(255)
 - Drop default empty string from timestamp field of page_touched

Bug: T230428
Bug: T164898
Change-Id: Ibdaf332ea1da309d31d35a6ebbc1b8fefced335e
2021-03-21 12:07:12 +01:00
Amir Sarabadani
11f091db7d Drop add_interwiki updater in Postgres
This function was removed in abstracting interwiki table (Id652cb544)
and it's not needed anymore.

Change-Id: Ifc956ae91f8362e9872cd449fcab5cfb4870ec7f
2021-03-20 18:25:02 +00:00
Amir Sarabadani
6a8bf52415 postgres: Fix drifts of indexes in user table compared to mysql
This is to make the migrating this table to abstract schema easier.
And reduce schema drifts between postgres and mysql.

Bug: T230428
Bug: T164898
Change-Id: I97a8791283e2499a559f1debb9b3c66909069283
2021-03-19 19:08:11 +00:00
Amir Sarabadani
2cc79854e8 Migrate archive table to abstract schema
One of the last ones left.

For MySQL/Sqlite:
 - Dropping default of ar_timestamp, empty string is not a valid
   timestamp.
 - Changing ar_title from "varchar() binary" to varbinary

for Postgres:
 - Set default for ar_namespace and ar_title
 - Change datatype of ar_comment_id, ar_actor, ar_namespace
The indexes were fixed separately.

Bug: T230428
Bug: T164898
Bug: T42626
Depends-On: I83cf1cd51ac9cf933c9175cefd6e38a6914f3494
Change-Id: Ic1d13a82b27f7fa39a0f0ea9c5b7b193b007e4ab
2021-03-13 21:51:16 +01:00
Ammarpad
cafd733c4f Postgres: Drop 1.24 upgrade logic
Bug: T272199
Change-Id: Ia68722e21a0e6310983932af32611f8da7190e6a
2021-03-09 07:20:05 +01:00
Ammarpad
2ca437dca9 Drop 1.27 upgrade patch files
6 files for Mysql/Sqlite/PG

Change-Id: Idef4906c5a7fdac2667c35bac7e8cc54629647f8
2021-03-09 07:15:37 +01:00
Amir Sarabadani
1053405664 Rename new_name_timestamp on recentchanges to rc_new_name_timestamp
To make it have a uniform prefix for index and column names

Bug: T270033
Change-Id: I8eb600416913092bd5aeb70389bba6e8a54d1d57
2021-03-01 19:00:52 +00:00
Ammarpad
a435378257 PostgresUpdater: Move bot_passwords table addition down
This should have no effect, but it helps in making this file
consistent with  Mysql/Sqlite updaters.

Table was introduced in 1.27 (Iaa4015e) and was added in
'new tables' section, because then Postgres separated them
per patch type instead of per release.

Separating them per release (as MySql/Sqlit do) is more logical
and it's even more important now that we are not keeping them
indefinitely.

Bug: T272199
Change-Id: I1fa6d81c9903fb6188f00b791794b3199a0a5aa3
2021-02-17 18:51:00 +01:00
Ammarpad
e4852caaa3 Drop 1.25 updgrade patch files.
5 files for MySql/Sqlite/Postgres.

MysqlUpdater.php seems to have incorrect comment for 1.26 release
The hitcounter table was dropped in 1.25 (I0e5006a), so all the
files dropped here are part of schema change for 1.25.

Bug: T272199
Change-Id: I6a509a54d31f68e423b3d76d26259b1f88aa22bd
2021-02-17 18:09:08 +01:00
Amir Sarabadani
fa7b284d70 Remove all old index checks in PG
I checked all of them with https://github.com/wikimedia/mediawiki/blob/REL1_26/includes/installer/PostgresUpdater.php
using a script and all of them except one are old and have
not been added after 1.26. The only left is actually added but changed
in the mean time and is needed.

Also cleaning up checkIwlPrefix that was introduced in 1.17.

Bug: T272199
Change-Id: Ifc58c8d860ebc0e6d154203cafc6a64654bced92
2021-02-13 20:24:14 +01:00
Amir Sarabadani
a20d1dfe17 Remove all old index additions in PG
I checked all of them with https://github.com/wikimedia/mediawiki/blob/REL1_26/includes/installer/PostgresUpdater.php
using a script and all of them are old and have not been added after 1.26

Bug: T272199
Change-Id: I47927d886c45ad9db25f1fdc035f1968f0c80993
2021-02-13 06:10:54 +01:00
Amir Sarabadani
7da3ba32b9 Remove all old data type changes and null changes in PG
I checked all of them with https://github.com/wikimedia/mediawiki/blob/REL1_26/includes/installer/PostgresUpdater.php
using a script and all of them are old and have not been added after 1.26

Bug: T272199
Change-Id: I3a48b16f91e7c08b3f4e7e6e3cdfd2287d50ee7d
2021-02-11 00:27:58 +01:00
Amir Sarabadani
f4667aecc1 Remove all old new field schema changes in PG
I checked all of them with https://github.com/wikimedia/mediawiki/blob/REL1_26/includes/installer/PostgresUpdater.php
using a script and all of them are old has not been added after 1.26

Bug: T272199
Change-Id: I643dd097240ebabb6bc4c3762ca3799e76d78e2b
2021-02-10 16:34:35 +01:00
jenkins-bot
c75fb1edec Merge "Remove all old foreign key deferrable changes" 2021-02-10 13:51:58 +00:00
Amir Sarabadani
93245ae042 Remove all old foreign key deferrable changes
I checked all of them with https://github.com/wikimedia/mediawiki/blob/REL1_26/includes/installer/PostgresUpdater.php
using a script and all of them are old has not been added after 1.26

We should not have FK in PG anymore (given the approved RFC T164898

Bug: T272199
Change-Id: I88ac9359e63ce8d12f24ea8e7c2247b33135b025
2021-02-10 00:11:45 +01:00
jenkins-bot
51a271880b Merge "Drop 1.17 upgrade patch files" 2021-02-09 16:02:14 +00:00
Ammarpad
09bf630920 Drop 1.17 upgrade patch files
14 files.

Bug: T272199
Change-Id: I0ff387e057c1fb35447595a596aa3fec455a795c
2021-02-08 16:55:15 +00:00
Amir Sarabadani
6809067ef3 Fix drifts in columns of recentchanges in PG
To make abstracting this table easier. Reducing the schema drift between
schema of this table in PG and MySQL:
 - Changing datatype of four fields
 - Set default for seven fields
 - Change nullability of two fields.

Bug: T230428
Bug: T164898
Change-Id: Id6fa9fd1ebf840f6354fcd8b8ebf0e393ba9e624
2021-02-06 01:19:00 +01:00
Ammarpad
4fe97dfd8b Postgres: Drop some pre-1.25 upgrade schema updates (part 1)
These are not clearly marked per release as they're in MysqlUpdater
until we reach 1.23 release, and I am not sure whether they're truly
in chronological order. Some of the files dropped here exists for Mysql
and here is there corresponding versions there, the rest do not exist
there.

* patch-page_restrictions.sql --1.10
* patch-protected_titles.sql --1.12

* patch-page_props.sql --1.13
* patch-category.sql --1.13
* patch-updatelog.sql --1.13

* patch-change_tag.sql --1.15

* patch-user_properties.sql --1.16
* patch-log_search.sql --1.16
* patch-l10n_cache.sql -- 1.16

* patch-iwlinks.sql -- 1.17
* patch-module_deps.sql -- 1.17

* patch-uploadstash.sql -1.18
* patch-user_former_groups.sql --1.18

* patch-sites.sql --1.21

These have no corresponding files
* patch-querycachetwo.sql
* patch-redirect.sql

Bug: T272199
Change-Id: I42830ffe8eb3ccad9b1f55d9f2629b388806335b
2021-02-03 06:57:12 +01:00
Ammar Abdulhamid
dbd4dd19f8 Rename site_identifiers indexes to have si_ prefix
Bug: T270033
Change-Id: I6751f0fd992054b61222ece55c83d05d24af9000
2021-01-30 12:19:55 +01:00
Amir Sarabadani
fe6ff91134 Migrate image table to abstract schema
For MySQL/Sqlite:
 - Change datatype of img_name from "varchar() binary" to varbinary.
 - Drop default of img_timestamp

For Postgres:
 - Adding two missing indexes.
 - Renaming two indexes
 - Setting default value for five fields
 - Fix data type of four fields
 - Drop default of img_metadata
 - Make three fields not nullable

Bug: T230428
Bug: T164898
Change-Id: I237af3558b0e1c1fecd874c3c90ba6780e50aaa4
2021-01-28 20:13:03 +01:00
Amir Sarabadani
7f6c51617b Standardize archive indexes
For Sqlite and MySQL, renaming name_title_timestamp to
ar_name_title_timestamp so it follows the database convention.

For Postgres:
 - Rename archive_name_title_timestamp to ar_name_title_timestamp
 - Drop archive_actor (that has only ar_actor)
 - Add ar_actor_timestamp (that has ar_actor, ar_timestamp)

This fixes drifts of PG and MySQL and makes work for abstracting the
table easier.

Bug: T230428
Bug: T164898
Change-Id: I123a4c47602bdd415f0fe5823f96159dcd0d84b8
2021-01-28 11:32:49 +01:00
Amir Sarabadani
6e53acb7cc Migrate ipblocks to abstract schema
For MySQL/Sqlite:
 - Drop default values of ipb_timestamp and ipb_expiry as part of
   standardizing timestamp columns

For Postgres:
 - Drop foreign key on two columns as approved by the RFC
 - Set default of ipb_user
 - Make three columns not nullable to sync with MySQL
 - Change data type of two columns to BIGINT to be the same as MySQL

Bug: T230428
Bug: T164898
Bug: T42626
Change-Id: I2c5303d76c6ce059d7fef324a4521c6336c5b1f3
2021-01-23 18:21:24 +00:00