aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/postgres/archives
Commit message (Collapse)AuthorAgeFilesLines
* Move SQL schema and schema changes to new sql/ top-level directoryDaimona Eaytoy2024-12-1336-323/+0
| | | | | | | | | | | | | | | | | | | | | | | | This is the standard in every extension. DB schema changes are not maintenance scripts, and therefore there's no apparent reason to have the two things together, besides historical reasons. Also, put each DB type in a separate directory, which wasn't the case for MySQL before. For SQLite and Postgres schema changes, we now follow the convention (used everywhere else, including the generateSchemaChangeSql script) of having the DB type as the last part of the path. This lets us generate schema changes for all DB types at once, and without specifying the full file path. Most files are just being renamed, the exceptions being to update references to the old location (sometimes still referencing tables.sql). Note that the old path is still referenced in the autogenerated comment of schema changes SQL files. These will be regenerated in another commit. Instead, the schema files are done now, because they're covered by DatabaseIntegrationTest that would otherwise fail. Bug: T382030 Change-Id: I3b4a614366d0bc629523ac40ce97d001f3b6bcf8
* Searchindex primary key, title length and utf8mb4Derk-Jan Hartman2024-10-231-0/+12
| | | | | | | | | | | | | | | | - Make si_page primary key - Allow si_title to be larger - Switch from utf8 to utf8mb4 - Remove default of empty string for titles Sqlite is not migrated, as it has it's own overrides Postgres is migrated, but is not in actual use This is mostly from I273e3a7715abf97d2889904642c7c375e76de4f6 Bug: T249976 Bug: T231827 Change-Id: I12adff3e6ca6a9986ff207bef16272195c3a6a48
* schema: Drop old pagelinks columnsAmir Sarabadani2024-06-181-0/+18
| | | | | | | It has been dropped in production already. Bug: T299947 Change-Id: I8ec1e7d9224c81d6494c39c78df9e4bdac38d377
* Merge "Drop 1.35 db updates"jenkins-bot2024-05-052-9/+0
|\
| * Drop 1.35 db updatesAlexander Vorwerk2024-05-032-9/+0
| | | | | | | | | | | | | | Per official policy, updates from versions older than two LTS releases are not supported. Change-Id: I8fb08e226c1a37580f95ee622a0703eee312d9ba
* | Make rc_id a bigintAlexander Vorwerk2024-05-042-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Wikidata is at 51.3% of its maximum value (see [1]), so we still have comfortable time to make this change, but it will inevitably be necessary and there is no point in postponing this change into the future. The autoincrement value will not get smaller. ¯\_(ツ)_/¯ Also since rc only stores stuff for 30 days, the table is not that big. [1] - https://grafana.wikimedia.org/d/79S1Hq9Mz/wikidata-reliability-metrics?viewPanel=29&orgId=1 Bug: T63111 Change-Id: Icf3dc9815814ef73aa6a39f1c221a349e6b76872
* | Cleanup revision table schemaAlexander Vorwerk2024-05-041-0/+14
|/ | | | | | | | | * Drop default value from rev_actor and rev_comment_id * Make rev_id a bigint Bug: T215466 Depends-On: I88318d7bcc063bc86a56eeb5f00048ea6e81964b Change-Id: Id0a3d920e8b2dc8643fa3c0341b34ab3ed5761dc
* Schema: Drop iwl_prefix_from_title from iwlinksAmir Sarabadani2024-02-081-0/+5
| | | | | | | | | | | | After exhuastive research, we concluded that iwl_prefix_from_title is not used and in case it's actually used, other indexes provide enough cardinality. This table is about to grow quite large in Commons, let's avoid making it bigger than it needs to be. Bug: T343131 Change-Id: I89e40dff384291968d2465e4109a3d212ae2f8c7
* Schema: Drop unused and useless indexes of sites tableAmir Sarabadani2024-02-011-0/+11
| | | | | | | | | | | | | This table has eight indexes plus PK. It has around 1000 rows only. Even if it needs these indexes (which it doesn't), they are still useless. Looking at the code, the only potential useful index is the one on site_global_key, they are showing up in the report of unused indexes in the db and I checked with Fandom (which might benefit from an index on this table) and they said they don't use sites table. Bug: T342856 Change-Id: I06b3db0f33bd35bfa68f4b418d8c2f4b9b988409
* Schema: Drop cl_collation_ext indexAmir Sarabadani2024-01-261-0/+5
| | | | | | | Unused since Ie4dd91ee29308c980e Bug: T342854 Change-Id: I3acf563c64ff176ade3e0c6745839a168e92473b
* Add the new block and block_target tablesTim Starling2024-01-081-0/+48
| | | | | Bug: T346293 Change-Id: I3822ad03227405a608dea1d788bcdb8321b95bb3
* Use year in temporary user names and restart index each yearThalia2024-01-051-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * Part of a temporary user name is generated from an index that increments, which is stored in the database. * As specified in T345855, the index will be restarted each year. * Also specified in T345855, the year will be included in generated temporary user names. What: * Since the year must be included in the name in order to avoid naming conflicts if the index is restarted each year, both are implemented together and controlled by a single config. * Add a new config option that, when true, restarts the name generation index at the start of each year and add the year into the user name: $wgAutoCreateTempUser['serialProvider']['useYear'] * Add a uas_year column to the user_autocreate_serial table, which is unique in combination with uas_shard, so the index can be stored for each shard/year combination. * The year is added into the username just after the prefix, as specified in T345855. This is based on research that having the year near the start of the name aids understanding that the names are not IP addresses. The position of the year within the name is therefore not configurable (though whether to include it is). See T345855 for the research. Bug: T349494 Bug: T349501 Depends-On: I6b3c640a4e74f52fd4a4f46de5a2cbe80fe3b665 Change-Id: If51acb3f4efa361ce36d919c862a52501a5a7d24
* installer: Fix location of patch-pagelinks-target_id.sql for postgresUmherirrender2023-11-201-0/+0
| | | | | | Bug: T351619 Follow-Up: I2ed692d7d0cdf756d29618363bec7fc761ff3df1 Change-Id: Ie2273c6803a83831b09f176057d6a9afccdfbdf2
* Store image sizes as 64-bit bigint instead of 32-bit integersBrian Wolff2023-10-044-0/+20
| | | | | | | | This is meant in preparation for MediaWiki supporting files larger than 4gb. Bug: T191805 Change-Id: Ie67dd01aa0a8b28d9afc1805243e711fcadbc0f8
* Schema: Drop old externallinks columns and indexesAmir Sarabadani2023-09-051-0/+14
| | | | | | | | | | Already dropped from production Also dropping FixExtLinksProtocolRelative as it's not useful anymore and it has been run in previous releases so it's not worth fixing. Bug: T312666 Change-Id: I1dd6e704b34e685ada6e316da11243d10827d769
* Schema: Add pl_target_id column to pagelinksAmir Sarabadani2023-07-251-0/+8
| | | | | | | Similar to templatelinks Bug: T342689 Change-Id: I2ed692d7d0cdf756d29618363bec7fc761ff3df1
* Schema: Set default or nullable to three columns of externallinksAmir Sarabadani2023-07-181-0/+14
| | | | | | | | | | | | | We need to drop these columns and we need to make them take default values so we can issue write queries without these columns. Also noting that MySQL prior to 8.0 can't set default values to blob columns making this way more complicated than it should be but MariaDB can set them (https://mariadb.com/kb/en/blob/). We also made these columns nullable to make this work in MySQL. Bug: T341828 Change-Id: I0d60742b6ce7adf642393ee00b66aa539b76dfc1
* Improve idempotency of postgres index upgradesMarks Polakovs2023-05-176-8/+8
| | | | | | | | | Change DROP INDEX statements to DROP INDEX IF EXISTS, meaning the upgrade does not fail if they do not already exist (which is the desired end state anyway). Bug: T336868 Change-Id: Id073beda84065b067994a7405a78d484346b550d
* schema: Add user_is_temp column to the user tableThalia2023-05-101-0/+6
| | | | | | | | | This allows temporary users to be identified from applications external to MediaWiki, by the user table alone (without referring to the $AutoCreateTempUser['matchPattern'] config). Bug: T333223 Change-Id: I83c5ff42654164590fb0361c84e65a5315ddbda8
* postgres: Make the upgrade ignore dropping indexes that might not existAmir Sarabadani2023-02-271-7/+3
| | | | | | | | | Due to drifts, 1.35 didn't have tl_namespace nor tl_backlinks_namespace but that was fixed in 1.36 which the drop of tl_title tries to drop leading to errors. Bug: T330382 Change-Id: I555e855b3c0e97e5df1f0fab1de104301d40eae4
* schema: Add new fields for externallinks so we can reduce duplicationAmir Sarabadani2022-10-181-0/+11
| | | | | Bug: T318604 Change-Id: I217817bc518eaa86c9952187c6f1a861f480ccaf
* Drop useless maint scripts and sql files after 1.31-1.33 clean upAmir Sarabadani2022-09-2811-72/+0
| | | | | | | | | | These files are not needed anymore. Either because they are orphan now and no updater will run these sql files. Or they are maint scripts to migrate the data and that has been removed in I5ff9630a65 and I84bd1d3dbe7 Change-Id: I00c49d8d649e3fa7641f3c57bf3ea4440ae542df
* Drop 1.32 and 1.33 db updatesAmir Sarabadani2022-09-264-51/+0
| | | | | | | | | | | | | Per official policy, updates from versions older than two TLS releases are not supported. Finding the implicit marker is a bit tricky. The user might try to upgrade from a really old version that doesn't have tag_summary table and mistakenly think it's new and allow upgrade. So turning the check logic into a boolean AND where it must be new enough to have change_tag_def table AND new enough not to have tag_summary table. Change-Id: I5ff9630a6539a587a47930847e108ac53757106f
* Drop 1.31 db updatesAmir Sarabadani2022-09-262-20/+0
| | | | | | | | | | Per official policy, updates from versions older than two TLS releases are not supported. We can drop more versions, given that 1.39 is LTS but to ease the review, let's drop one release per patch Change-Id: I84bd1d3dbe777909e30710fff5bcb655af9a4261
* schema: Drop tl_title and tl_namespace fields from templatelinksAmir Sarabadani2022-09-061-0/+10
| | | | | | | | The day has gone. Still keeping the code as the schema changes are not done in production but the data migration has been finished. Bug: T299417 Change-Id: I906e069a63d1dae14924c72318b22b16244371d6
* TempUser infrastructure and servicesTim Starling2022-04-141-0/+5
| | | | | | | | | | | | | | | | | | Add services and utilities for automatic creation of temporary user accounts on page save, in order to avoid exposing the user's IP address. * Add $wgAutoCreateTempUser, for configuring the system * Add TempUserConfig service, which interprets the config. * Add TempUserCreator service, which creates users during page save as requested by EditPage. With proxy methods to TempUserConfig for convenience. * Add table user_autocreate_serial. Table creation is necessary before the feature is enabled but is not necessary before deployment of this commit. Bug: T300263 Change-Id: Ib14a352490fc42039106523118e8d021844e3dfb
* Bump minimum required version for upgrade to 1.31Alexander Vorwerk2022-03-153-19/+0
| | | | | | | 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
* Add tl_target_id to templatelinksAmir Sarabadani2022-01-281-0/+8
| | | | | | | | Part of normalizing it, note that the field must be nullable now and that will change later. Bug: T299418 Change-Id: Id543dfa20a153312f66d2f45a64ac23e7272dabe
* Drop rev_page_id index on revisionAmir Sarabadani2022-01-271-0/+5
| | | | | | | This is already applied in production and known to be safe. Bug: T163532 Change-Id: Ief29372f13b2d7cdb19395dcda6eb15e9a53efca
* Add linktarget tableAmir Sarabadani2022-01-211-0/+8
| | | | | Bug: T299416 Change-Id: Icae4513dd99635335857100d8a0c7102986933e5
* Migrate searchindex to abstract schemaAmir Sarabadani2021-05-271-0/+12
| | | | | | | | | | | | | 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
* objectcache: add last-modified token field to objectcache tableAaron Schulz2021-05-181-0/+8
| | | | | | | | | | 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
* Merge "Drop unused patch-rc_cur_id-not-null.sql"jenkins-bot2021-04-021-1/+0
|\
| * Drop unused patch-rc_cur_id-not-null.sqlAmir Sarabadani2021-04-021-1/+0
| | | | | | | | | | | | Unused since Iebb6855e8f6f44470bb (2012) Change-Id: I82d16d2c0d28902a0c3aedf8fece69c02a56c95c
* | Merge "Drop unused patch-update_sequences.sql"jenkins-bot2021-04-021-20/+0
|\ \
| * | Drop unused patch-update_sequences.sqlAmir Sarabadani2021-04-021-20/+0
| |/ | | | | | | | | | | Unused since r71040 (2010) Change-Id: Ib0d841a974eef95898e4627d0b93ab3dd4d64f93
* / Drop now unused patch-kill-iwl_prefix.sqlAmir Sarabadani2021-04-021-6/+0
|/ | | | | | | Leftover from I0ff387e057c1fb Bug: T272199 Change-Id: If05e8613b6c87d8267088e6d082a8324359469b1
* Drop now unused patch-categorylinks-better-collation.sqlAmir Sarabadani2021-04-021-8/+0
| | | | | | | Leftover from I0ff387e057c1fb Bug: T272199 Change-Id: I6a00353eeb16496ce3ed2cd5f39906fa3b35e204
* Drop unused patch-uploadstash_sequence.sqlAmir Sarabadani2021-03-301-2/+0
| | | | | | | | | | | 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
* Remove unused schema change.Ammarpad2021-03-271-6/+0
| | | | | | | There's no reason to keep schema change that's no longer useful. History is already tracked by git. Change-Id: Ia8aa0d21ae5f2d799d9a641ebe7b924f56e07ab1
* Drop rest of unsupported upgrade paths and patches in PostgresAmir Sarabadani2021-03-223-16/+0
| | | | | | | | 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
* Drop tsearch fixes in postgresAmir Sarabadani2021-03-222-42/+0
| | | | | | | | 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
* Drop unsupported 1.23 upgrade code and patches from PostgresAmir Sarabadani2021-03-221-5/+0
| | | | | | | We don't support upgrading from 1.23 anymore. Bug: T272199 Change-Id: Iac9652095927c86c47f45a2aa131c28efef5c73a
* Drop add_interwiki updater in PostgresAmir Sarabadani2021-03-201-13/+0
| | | | | | | This function was removed in abstracting interwiki table (Id652cb544) and it's not needed anymore. Change-Id: Ifc956ae91f8362e9872cd449fcab5cfb4870ec7f
* Drop 1.27 upgrade patch filesAmmarpad2021-03-091-9/+0
| | | | | | 6 files for Mysql/Sqlite/PG Change-Id: Idef4906c5a7fdac2667c35bac7e8cc54629647f8
* Rename new_name_timestamp on recentchanges to rc_new_name_timestampAmir Sarabadani2021-03-011-0/+5
| | | | | | | To make it have a uniform prefix for index and column names Bug: T270033 Change-Id: I8eb600416913092bd5aeb70389bba6e8a54d1d57
* Remove all old index checks in PGAmir Sarabadani2021-02-131-2/+0
| | | | | | | | | | | | 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
* Postgres: Drop some pre-1.25 upgrade schema updates (part 1)Ammarpad2021-02-0317-194/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Migrate objectcache to abstract schemaAmmar Abdulhamid2021-01-201-0/+4
| | | | | | | | | | | | | | | | | 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
* Migrate text table to abstract schemaAmir Sarabadani2021-01-092-4/+4
| | | | | | | | | | | | 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