Commit graph

449 commits

Author SHA1 Message Date
Alexander Vorwerk
d66fe8b7c7 Bump minimum required version for upgrade to 1.31
The policy allows this and since 1.39 is going to be the next LTS
release, I think it is fine to do this now.

Change-Id: If426e0ee349252ccc0ba9c4222c7d6865ab57fa2
2022-03-15 22:12:59 +01:00
Amir Sarabadani
9137db1d8a Add tl_target_id to templatelinks
Part of normalizing it, note that the field must be nullable now and
that will change later.

Bug: T299418
Change-Id: Id543dfa20a153312f66d2f45a64ac23e7272dabe
2022-01-28 17:41:01 +01:00
Amir Sarabadani
203d422dc4 Drop rev_page_id index on revision
This is already applied in production and known to be safe.

Bug: T163532
Change-Id: Ief29372f13b2d7cdb19395dcda6eb15e9a53efca
2022-01-27 09:43:27 +01:00
Amir Sarabadani
4a6e986141 Add linktarget table
Bug: T299416
Change-Id: Icae4513dd99635335857100d8a0c7102986933e5
2022-01-21 15:52:58 +01:00
Amir Sarabadani
ede308ed55 Drop pr_user from page_restrictions
It's not used for 13 years, safe to say it won't be used anytime soon

Bug: T199377
Change-Id: Iecf4fb6046699a1758ad2d1dc55a3ee8eb4b0389
2021-12-06 14:15:39 +01: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
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
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
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
jenkins-bot
e614e8653e Merge "Drop unused patch-rc_cur_id-not-null.sql" 2021-04-02 23:01:34 +00:00
jenkins-bot
fc8944012a Merge "Drop unused patch-update_sequences.sql" 2021-04-02 22:54:59 +00:00
Amir Sarabadani
ac7391c6ea Drop unused patch-rc_cur_id-not-null.sql
Unused since Iebb6855e8f6f44470bb (2012)

Change-Id: I82d16d2c0d28902a0c3aedf8fece69c02a56c95c
2021-04-02 15:57:54 +02:00
Amir Sarabadani
1980d47f7f Drop unused patch-update_sequences.sql
Unused since r71040 (2010)

Change-Id: Ib0d841a974eef95898e4627d0b93ab3dd4d64f93
2021-04-02 15:55:58 +02:00
Amir Sarabadani
18b33350d8 Drop now unused patch-kill-iwl_prefix.sql
Leftover from I0ff387e057c1fb

Bug: T272199
Change-Id: If05e8613b6c87d8267088e6d082a8324359469b1
2021-04-02 02:12:07 +02:00
Amir Sarabadani
b4a236b9d9 Drop now unused patch-categorylinks-better-collation.sql
Leftover from I0ff387e057c1fb

Bug: T272199
Change-Id: I6a00353eeb16496ce3ed2cd5f39906fa3b35e204
2021-04-02 00:02:19 +02:00
Amir Sarabadani
4213630c2a Drop unused patch-uploadstash_sequence.sql
This was introduced in r103367 as a follow up to r103365 while none of
the commits wire this to update.php and since then it has been unused.

And even if it was wired dynamically somehow that I missed, it's not
needed anymore as we don't support direct upgrades from these versions
(1.18 and 1.19) anymore.

Change-Id: I1e16de398bbe61adcb55787117378ea96a2b3e9f
2021-03-30 20:42:16 +02: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
jenkins-bot
48674bee1d Merge "Drop two unused Perl scripts" 2021-03-28 02:17:35 +00:00
Ammarpad
0e7bf93d48 Drop two unused Perl scripts
Probably nobody is using these.

Also hopefully after fully migrating to abstract schema, there'd
not be any more unnecessary drifts between MySQL and Postgres tables,
obsoleting the need for compare_schema.pl

For mysql2postgres.pl, dumpBackup.php/importDump.php can be used.

Bug: T258876
Change-Id: Ief36bca6f3a387f811408f2a5e4840656dfffff2
2021-03-27 11:47:48 +01:00
jenkins-bot
85f757fefa Merge "Remove unused schema change." 2021-03-27 09:37:16 +00: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
Ammarpad
81ba51eb0e Postgres: Remove page_deleted trigger
Bug: T164898
Change-Id: Ie7ff5ff9fd649f27564443e17e602c4bc61669fc
2021-03-27 07:29:00 +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
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
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
Amir Sarabadani
4a6d4baaed Migrate recentchanges table to abstract schema
This table is massive but thankfully we fixed most of its complexities
in previous patches.

For MySQL/Sqlite:
 - Change type of rc_title and rc_source from "varchar binary" to
   "varbinary"
 - Drop default of rc_timestamp
 - Change rc_timestamp from varbinary(14) to binary(14) to standardize
   timestamp datatypes

One index doesn't follow the uniform prefix rule but since it's in a
maintenance script, will fix that in a follow up.

Bug: T230428
Bug: T42626
Change-Id: I13994e02ad3a2293148346ef7be96746578ad854
2021-02-26 13:56:56 +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
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
Ammar Abdulhamid
20d1849b53 Migrate objectcache to abstract schema
For Postgres:
 - Drop Unique constraint on `keyname` and make primary key
 - Change type of `value` from BYTEA to TEXT and drop its default
 - Make `value` nullable to sync with MySQL/SQLite

MySQL:
 - Change exptime from DATETIME to TIMESTAMP

MySQL/SQLite:
 - Make 'exptime' not nullable

Bug: T230428
Bug: T164898
Change-Id: Iab9de8a1bb2cb01b6e3e69e66f1bbe089d53d0a7
2021-01-20 13:50:28 +01:00
Amir Sarabadani
31513848ef Fix Postgres index drifts on recentchanges table
To make migrating recentchanges table to abstract schema easier

Bug: T230428
Bug: T164898
Change-Id: I727dfc6b644701bd99d49628dfeeaa0ca46f168c
2021-01-16 23:15:54 +01:00
Amir Sarabadani
dba59bc223 Migrate oldimage to abstract schema
For MySQL/Sqlite:
 - Changing oi_name and oi_archive_name to varbinary instead of "varchar
   binary"
 - Dropping default from oi_timestamp

For Postgres:
 - Adding the correct default to seven fields
 - Removing incorrect default from oi_metadata
 - Add missing index oi_actor_timestamp
 - Change four fields to have correct data type
 - Make oi_major_mime and oi_minor_mime not nullable
 - Drop foreign key on oi_name

Bug: T230428
Bug: T164898
Change-Id: I4dff0e48081a5797a29513f9c8b87f9ffcaadb5d
2021-01-16 21:18:25 +01:00
Amir Sarabadani
c33876f834 Migrate text table to abstract schema
For MySQL/Sqlite, drop the table options, they are for MySQL < 5.0 which
was released in 2003 and not any use today.

For Postgres, rename pagecontent table to text, approved as part of the
RFC. Swap order of creating auto-generated tables and manual tables.

Bug: T230428
Bug: T164898
Change-Id: Id7510b80beed7a7297353094a57d5e2d4f12fc64
2021-01-09 16:07:54 +01:00
Amir Sarabadani
5cfdb13c0f Add missing PG indexes of ipblocks
To make the work of abstracting this table easier.

Bug: T230428
Bug: T164898
Change-Id: I259c99aec7b6df27269fe02172ae4905ecfd29c2
2021-01-09 15:01:51 +01:00
Ammarpad
bbda7591e1 Use TIMESTAMPTZ consistenly in Postgres SQL schema
'TIMESTAMPTZ' is an alias for the canonical name of the data type
'TIMESTAMP(0) WITH TIME ZONE' which though descriptive, looks rather
convoluted. Let's use the alias for consistency throughout.

Bug: T230428
Follow-up: Iabbe8f085812acd90536a06fee2ecd4db9b047d5
Change-Id: I277658b1ebd851466022e7874579cf507684d40a
2021-01-03 02:10:20 +01:00