Commit graph

124 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
1476e3b5b5 Migrate categorylinks to abstract schema
To get MySQL/SQLite migrated, changing type of cl_to and
cl_sortkey_prefix from "varchar() binary" to varbinary

For Postgres:
 - Dropping foreign key on cl_from
 - Setting proper default for cl_from, cl_to, cl_sortkey, cl_collation
 - Set cl_sortkey to not nullable
 - Dropping unique index cl_from which in turn should become PK
 - Adding several missing indexes
 - Fixing columns of cl_sortkey

Bug: T230428
Bug: T164898
Change-Id: I83043ef41f9c753734f1e4b51237d979031dd71a
2020-12-03 07:43:02 +00:00
jenkins-bot
d009d75c73 Merge "Start generateSchemaChangeSql.php" 2020-11-16 08:40:36 +00:00
Amir Sarabadani
1125167b8d Start generateSchemaChangeSql.php
Creating schema changes from abstract schema and even abstracting a
schema change.

Bug: T230420
Change-Id: If626e866642af820dd70c5f9b0fe7c6a951e0a25
2020-11-01 21:14:53 +01:00
Ammar Abdulhamid
6599e5706c Migrate querycache_info to abstract schema
Additional changes for Postgres:
 - Set empty string as default for qci_type
 - Set PG-equivalent of the given MySql/Sqlite timestamp as
   default timestamp for qci_timestamp
 - Make qci_type non nullable
 - Make qci_timestamp non nullable
 - Drop UNIQUE constraint on qci_type

Bug: T230428
Bug: T164898
Depends-On: If344395615087c360597a5b3d66ea03e930b7d9b
Change-Id: I741d2d079696d4b4eba09945341054d2a145bddc
2020-10-20 08:18:03 +01:00
Amir Sarabadani
cd7a28d30f Migrate iwlinks to abstract schema
In order to migrate MySQL and Sqlite to abstract schema changed the
iwl_title data type from varchar binary to varbinary. This wouldn't
affect production.

For migrating Postgres:
 - Turning the unique index to PK to make it in sync with MySQL

Bug: T164898
Bug: T230428
Change-Id: Iaa625b66c874023b8cf2403917fa2fa120279208
2020-09-05 20:02:43 +02:00
Amir Sarabadani
1770341562 Migrate langlinks to abstract schema
In order to migrate MySQL and Sqlite to abstract schema changed the
ll_title data type from varchar binary to varbinary. This wouldn't
affect production.

For migrating Postgres:
 - Dropping foreign key on ll_from
 - Setting default of empty string for ll_lang and ll_title
 - Make ll_lang and ll_title both non-nullable to be in sync with MySQL
 - Turning the unique index to primary key, similar to MySQL
 - Renaming an index to sync with MySQL

Bug: T164898
Bug: T230428
Change-Id: I57f22896ff67266f99bf08f6dd1b9cc4c51b1db9
2020-09-05 19:29:23 +02:00
jenkins-bot
d259363ac4 Merge "Migrate l10n_cache and module_deps to abstract schema" 2020-08-09 15:05:29 +00:00
Gergő Tisza
f424801768 Fix DROP CONSTRAINT for interwiki.iw_prefix PostgreSQL patch
This partialy reverts commit 9e9414db50.

DROP CONSTRAINT is part of ALTER TABLE in PostgreSQL, not a stadalone command.

Change-Id: Ifd1b4235ea3b94d130fa3a89739af68a6db820f7
2020-08-08 23:25:43 +00:00
Amir Sarabadani
9e9414db50 Fix primary key sql patches of Postgres
Out of six PK SQL patches for Postgres, two of them were broken
because you can't put drop index inside alter table:
http://sqlfiddle.com/#!17/2acf44/1

One of them were caused by yours truly copying from the other one.

Also fixing file name in one the pk patches.

Noticed in I60a2b65d

Change-Id: If793ea61437d46adf3e05c38df4ad37bce81c5cf
2020-08-07 21:30:24 +02:00
Amir Sarabadani
5e69ad1aad Migrate l10n_cache and module_deps to abstract schema
Also, fixing two data type drifts in Postgres:
 - lc_key was varchar (with no binary flag) in MySQL but TEXT in
   Postgres while PG supports varchar. Changing PG to varchar.
 - lc_value was BYTEA but the rest of varbinary fields are mapped to
   TEXT, changing it to TEXT data type.

And fixing primary key of these tables in Postgres too as it was a unique index instead.

Bug: T198811
Bug: T164898
Bug: T230428
Change-Id: I50305556bd870461d05f98c5272cf1d6a65deb15
2020-08-06 22:07:22 +02:00
Amir Sarabadani
b345b8f6da Migrate user_properties to abstract schema
Also, dropping foreign key constraint on user_properties.up_user as it's decided to
drop all of foreign key constraints in T164898

And fixing primary key of the table in Postgres as it was a unique index
instead.

Bug: T198811
Bug: T164898
Bug: T230428
Change-Id: I60a2b65df62ec93a363309f8a17c29b83fd6f058
2020-07-31 17:49:50 +02:00
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
Reedy
c00c34f288 Split down patch-comment-table.sql
Bug: T227662
Change-Id: I7617616df57f7468d06e9b52426b6851bfef0e7d
2019-08-20 19:35:57 +00: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
Amir Sarabadani
1427bb1821 Drop ct_tag column from change_tag table
Bug: T194163
Change-Id: I05d43510b51a67733b0107f0a768e261fe8ddabd
2018-11-28 23:03:43 +01: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
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
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
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
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
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