aboutsummaryrefslogtreecommitdiffstats
path: root/includes/installer/MysqlUpdater.php
Commit message (Collapse)AuthorAgeFilesLines
* ResourceLoader: Remove module_deps tableHannah Okwelum2025-02-131-0/+1
| | | | | | | No longer used. see T343492 Bug: T379661 Change-Id: I6b3d51995452f77b5da86b0cf32a23b12c7c669c
* schema: Add cl_target_id and cl_collation_id to categorylinksAmir Sarabadani2025-01-211-0/+2
| | | | | | | To normalize cl_to and cl_collation Bug: T299951 Change-Id: If58190f3cc912ffa99c623dc9f51d530d5c87186
* schema: Introduce file tableAmir Sarabadani2025-01-031-0/+1
| | | | | | | First step in reworking storage of files metadata in the database Bug: T368113 Change-Id: I6e79c47f9b6a191a3599db5f0a1a44e73b89be22
* Add migrateSearchindex functionsDerk-Jan Hartman2024-11-141-1/+22
| | | | | | | | | | | | | | This runs migrations that were previously attempted. Postgres never executed as the renameindex failed and it never ran the patch either. MySql did run, but was relying on renameIndex with PRIMARY, which is a bad idea. The function now runs it as a patch, with upgrade row in the log, but also checks for the lack of the old index in case the users were already on 1.44 or if they used 1.43rc Bug: T379591 Change-Id: I7e74ccbf8cf2b105e8e6dedf812af3487c18113b
* installer: Move searchindex changes into 1.43 section after backportReedy2024-11-051-2/+2
| | | | | Follows-Up: I12adff3e6ca6a9986ff207bef16272195c3a6a48 Change-Id: I7518628f026a5599d6b4d932e7ec9a3fbaed87b2
* Searchindex primary key, title length and utf8mb4Derk-Jan Hartman2024-10-231-0/+30
| | | | | | | | | | | | | | | | - 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
* Merge "Move update-keys.sql to a PHP array"jenkins-bot2024-09-161-0/+11
|\
| * Move update-keys.sql to a PHP arrayTim Starling2024-09-131-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve maintainability of update-keys.sql by moving the list from an SQL file to a PHP array in the same file as the updates it is disabling. It was apparently an SQL file for the convenience of third parties wishing to install MediaWiki by manually sourcing tables.sql. Support this use case by adding an option to update.php which inserts the update keys. Users should source tables-generated.sql and then run update.php --initial The array is the same for each DB type, but it's correct for it to have the same scope as getCoreUpdateList(). Factoring out common parts of getCoreUpdateList() and this new array is a separate project. Bug: T167924 Change-Id: I404ee29aadcc2f3f24f78d1111090395129cd021
* | Fix old autoblock unblock log entries with namespace in log_titleDreamy Jazz2024-09-131-0/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * The logging table on en.wikipedia.org contains an entry from 2005 which is an unblock of an autoblock. However, the log_title contains the namespace, which makes the code that looks for logs which target an autoblock fail (because it checks for the first character being '#'). * Fixing the log_title to remove the 'User:' prefix from rows which are autoblocks (i.e. searching for log_titles which start with 'User:#') should address the exceptions seen on Special:Log for these rows. ** The search can be limited to rows which have the 'unblock' log_action, as this has only been seen for this type of log. What: * Create fixAutoblockLogTitles.php which searches for the entries and then updates the log_title value to no longer include the 'User:' prefix ** The queries to search are split, such that the expensive LIKE query is performed on batches of row IDs. If the LIKE query is applied directly to all rows in the table, the query takes 30s to run on WMF production. * Add this maintenance script to update.php. It will be run once as the class extends LoggedUpdateMaintenance. * Test the newly added maintenance script to ensure it works. Bug: T373929 Change-Id: Ia62db56eda456bb764303b5f4b5a29be8f2d8fff
* schema: Remove allowInfinite from page_links_updatedUmherirrender2024-07-291-0/+1
| | | | | | | | | | This timestamp is to track the last refreshlinks run and is always now or in the past, there is no need to hold the infinite value. This only affects mysql Bug: T298317 Change-Id: I16978e076a795258639591a2fbfe353f67d0ec64
* Fix various version mention for class_aliasUmherirrender2024-07-051-1/+1
| | | | | | | | Versions are changed in 8e940c4f214ff7d17b53f51c6a46a5cf7fc2c92e, but that makes the version wrong Follow-Up: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0 Change-Id: Iae43725b8e0fffc4d44bf57f6227334b41290bd9
* Merge "DatabaseUpdater: Don't require script path in 'runMaintenance'"jenkins-bot2024-06-191-7/+7
|\
| * DatabaseUpdater: Don't require script path in 'runMaintenance'Bartosz Dziewoński2024-06-181-7/+7
| | | | | | | | | | Bug: T367918 Change-Id: If9453e0be0cca8cd5c90f0294f0978f672aa76b9
* | schema: Drop old pagelinks columnsAmir Sarabadani2024-06-181-0/+1
|/ | | | | | | It has been dropped in production already. Bug: T299947 Change-Id: I8ec1e7d9224c81d6494c39c78df9e4bdac38d377
* rdbms: remove unused indexHasField() helper methodsAaron Schulz2024-05-211-23/+0
| | | | Change-Id: Icc84ccc50ce7e262359eeabd8193edf6e966cac0
* block: Migrate to the new block schema on non-WMF wikisTim Starling2024-05-091-0/+2
| | | | | | | | | | | | Migrate from ipblocks to block/block_target and drop the ipblocks table. Update tests. In PostgresUpdater, change some schema update functions to skip field updates if the table doesn't exist, by analogy with DatabaseUpdater::modifyField. Bug: T346293 Change-Id: Icf91b35f7f729cead7c800429653eb30731762a1
* Merge "Drop 1.35 db updates"jenkins-bot2024-05-051-55/+0
|\
| * Drop 1.35 db updatesAlexander Vorwerk2024-05-031-55/+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-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+1
|/ | | | | | | | | * Drop default value from rev_actor and rev_comment_id * Make rev_id a bigint Bug: T215466 Depends-On: I88318d7bcc063bc86a56eeb5f00048ea6e81964b Change-Id: Id0a3d920e8b2dc8643fa3c0341b34ab3ed5761dc
* Run pagelinks migration for third parties tooAmir Sarabadani2024-04-271-0/+3
| | | | | | | | Production is read new almost everywhere, mediawiki core should reflect that as well. Bug: T299947 Change-Id: I8f05c4d7026394205bfc54b68dc725392852ae2a
* Standardise all our class alias deprecation comments for ease of greppingJames D. Forrester2024-03-191-3/+1
| | | | Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
* Schema: Drop iwl_prefix_from_title from iwlinksAmir Sarabadani2024-02-081-0/+1
| | | | | | | | | | | | 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/+1
| | | | | | | | | | | | | 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
* Add populateUserIsTemp.php to update.phpDreamy Jazz2024-01-291-0/+2
| | | | | | | | | | | | | | | | | | Why: * The populateUserIsTemp.php maintenance script is used to populate the user_is_temp column in the user table that was added in f283c0e99068259ea70e8926dc4792a461414264 but was not set to 1 for temporary users until 6e68107b3a56964e5b23cf575b905f8a6ed696d9. * This script therefore needs to be added to update.php so that wikis that enabled temporary account autocreation have this column populated. What: * Add to MysqlUpdater, PostgresUpdater, and SqliteUpdater code to run the populateUserIsTemp.php maintenance script. Bug: T355181 Change-Id: Ifea9f9c5740d01585c9f832c912ec98d28312e80
* Schema: Drop cl_collation_ext indexAmir Sarabadani2024-01-261-0/+1
| | | | | | | Unused since Ie4dd91ee29308c980e Bug: T342854 Change-Id: I3acf563c64ff176ade3e0c6745839a168e92473b
* installer: Namespace remaining classesReedy2024-01-131-1/+15
| | | | Change-Id: I11a8df30a2117ef29a4ade25f1082f25eb18490a
* Add the new block and block_target tablesTim Starling2024-01-081-0/+1
| | | | | Bug: T346293 Change-Id: I3822ad03227405a608dea1d788bcdb8321b95bb3
* Merge "Use year in temporary user names and restart index each year"jenkins-bot2024-01-051-0/+3
|\
| * Use year in temporary user names and restart index each yearThalia2024-01-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Minor cleanupReedy2024-01-051-2/+2
|/ | | | | | * Minor comment tweaks Change-Id: I76b44fcd88f27f6182f2b245301298a182e870f5
* Store image sizes as 64-bit bigint instead of 32-bit integersBrian Wolff2023-10-041-0/+4
| | | | | | | | This is meant in preparation for MediaWiki supporting files larger than 4gb. Bug: T191805 Change-Id: Ie67dd01aa0a8b28d9afc1805243e711fcadbc0f8
* installer: Add database updater for 2008/2011 redirect schema changesBartosz Dziewoński2023-09-211-0/+1
| | | | | | | | | | | | | | | | | | | In 2008, the `redirect` table was added, and in 2011, it gained the fields `rd_interwiki` and `rd_fragment`. We have never performed proper maintenance for those changes, instead relying on code in WikiPage to update it when the page was visited, or on an optional run of refreshLinks.php. I would like to remove the code in WikiPage, so we probably need to perform this maintenance in the database updater. You know, for the millions of people who have been dutifully upgrading their MediaWiki installations since 2008, but never visited the pages there. The script is a trimmed-down version of refreshLinks.php, without all the weird stuff, and using a better index for the queries. Bug: T346290 Change-Id: Iea251d2737b2fb472c4efb060ad2b97735b4ac53
* rdbms: Rename DatabaseMysqlBase to DatabaseMySQLAmir Sarabadani2023-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | Now that we merged DatabaseMysqli with DatabaseMysqlBase, there is no base anymore. I could have gone with DatabaseMysql, and the naming is not that consistent in rdbms: amir@amir-ThinkPad-P1-Gen-3:~/core/includes/libs/rdbms$ find . | grep -i mysql ./platform/MySQLPlatform.php ./field/MySQLField.php ./dbal/MWMySQLPlatform.php ./database/DatabaseMysqlBase.php ./database/DatabaseMysqli.php ./database/position/MySQLPrimaryPos.php ./database/resultwrapper/MysqliResultWrapper.php ./database/replication/MysqlReplicationReporter.php The majority is MySQL and since it's the correct form, I went with that instead. Change-Id: I3ee792f357dda974c855ba24b9b35e72fc73db06
* Schema: Drop old externallinks columns and indexesAmir Sarabadani2023-09-051-0/+1
| | | | | | | | | | 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/+1
| | | | | | | Similar to templatelinks Bug: T342689 Change-Id: I2ed692d7d0cdf756d29618363bec7fc761ff3df1
* Schema: Set default or nullable to three columns of externallinksAmir Sarabadani2023-07-181-0/+1
| | | | | | | | | | | | | 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
* Set default migration stage of externallinks to read new and write bothAmir Sarabadani2023-07-131-0/+1
| | | | | | Bug: T341828 Depends-On: I2d4ef8fc3bffa43bc611af3eab0494f4900df557 Change-Id: Ia55cb6cbdb28484e820f9cf3d6aacac00a86ffab
* Drop unused MysqlUpdater::checkBinAlexander Vorwerk2023-07-101-24/+0
| | | | | | Follow-Up: If9194f11ff574786e9f25afaf6899ea7e9c60fa1 Change-Id: Ib767c10930f7d794f9a19d1d7c2e2e03c6cb390f
* Drop revision_comment_tempAlexander Vorwerk2023-06-071-0/+1
| | | | | Bug: T299954 Change-Id: I85d21b1eff70a7d70e8ce14f25d66f7e7c76e5fe
* Migrate revision_comment_temp to rev_comment_idAlexander Vorwerk2023-05-271-0/+1
| | | | | Bug: T299954 Change-Id: If3224c73645d5ce5542228a6cee2848e98a9efee
* schema: Add user_is_temp column to the user tableThalia2023-05-101-0/+3
| | | | | | | | | 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
* Drop 1.34 db updatesAlexander Vorwerk2023-02-091-17/+1
| | | | | | | Per official policy, updates from versions older than two TLS releases are not supported. Change-Id: I3dc98fe61c8a508aa3ade694f8c0a6a00115031b
* schema: Add new fields for externallinks so we can reduce duplicationAmir Sarabadani2022-10-181-0/+3
| | | | | Bug: T318604 Change-Id: I217817bc518eaa86c9952187c6f1a861f480ccaf
* Drop 1.32 and 1.33 db updatesAmir Sarabadani2022-09-261-39/+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-261-29/+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/+1
| | | | | | | | 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
* Add support for write new for templatelinks migrationAmir Sarabadani2022-07-121-0/+2
| | | | | | | | | | - schema change to allow tl_namespace and tl_title being empty This is done by removing them from primary key. They don't need to be nullable as they have default value. - Make sure with WRITE_NEW, updater avoids writing to the old columns Bug: T306674 Change-Id: I2b8a29043e952060e7a79b6a7a3d647d48cd16fb
* schema: Drop legacy page_restrictions in page tableAmir Sarabadani2022-05-261-0/+2
| | | | | Bug: T35334 Change-Id: I17e73d5ef165481a5dd4c210da933b99c65ff79c
* Start clean up of revision_actor_temp tableAmir Sarabadani2022-05-231-3/+5
| | | | | | | It is being dropped in production Bug: T215466 Change-Id: I66b2cb8653252e720c897351065978119f040ba7