Page MenuHomePhabricator

Add the country migration script to the updater
Closed, ResolvedPublic

Description

Acceptance criteria

  • The default country migration stage is changed to MIGRATION_WRITE_BOTH
  • The migration script is added to the updater and is therefore run when running update.php
  • If the script would actually perform writes, it will first display a warning and a 15 seconds countdown
  • It should still be possible to run the script manually, passing --dry-run to test it

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptAug 6 2025, 3:33 PM

Change #1176244 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Integrate country migration in the updater

https://gerrit.wikimedia.org/r/1176244

Change #1176268 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Set the default country migration stage to MIGRATION_WRITE_BOTH

https://gerrit.wikimedia.org/r/1176268

Change #1176268 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Set the default country migration stage to MIGRATION_WRITE_BOTH

https://gerrit.wikimedia.org/r/1176268

Change #1176244 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Add country migration script to the updater

https://gerrit.wikimedia.org/r/1176244

vaughnwalters subscribed.

Acceptance criteria:
โœ… The default country migration stage is changed to MIGRATION_WRITE_BOTH
โœ… The migration script is added to the updater and is therefore run when running update.php
โœ… If the script would actually perform writes, it will first display a warning and a 15 seconds countdown
โœ… It should still be possible to run the script manually, passing --dry-run to test it


first testing by running this manually with --dry-run

docker-compose exec mediawiki php maintenance/run.php /var/www/html/w/extensions/CampaignEvents/maintenance/UpdateCountriesColumn.php --dry-run

Updating event country schema...
========= 43 events without address made online =========
980, 981, 984, 985, 991, 993, 994, 999, 1000, 1006, 1007, 1013, 1014, 1017, 1018,
1023, 1024, 1027, 1028, 1033, 1034, 1038, 1039, 1046, 1047, 1052, 1053, 1056, 1057, 1060,
1061, 1064, 1065, 1077, 1078, 1111, 1112, 1119, 1120, 1129, 1130, 1136, 1137,
========= 0 purged address rows (unused) =========
========= 0 address rows updated ========
========= 0 unmatched address rows ========
========= 0 events without country made online =========
========= Found 0 duplicated rows =========
NOTE: more could be found when running the script without --dry-run!

And at the end of the update script it did run the update, and also did the 15 second countdown:

docker-compose exec mediawiki php maintenance/run.php update

Updating event country schema...
The UpdateCountriesColumn script is about to update stored countries for all events. This is potentially DESTRUCTIVE, because countries that can't be mapped to a valid country code will be deleted, and the respective events will be changed to online. If you wish to take a closer look, abort with control-c in the next 15 seconds and run the script manually. (skip this countdown with --nowarn) ... 00
========= 43 events without address made online =========
980, 981, 984, 985, 991, 993, 994, 999, 1000, 1006, 1007, 1013, 1014, 1017, 1018,
1023, 1024, 1027, 1028, 1033, 1034, 1038, 1039, 1046, 1047, 1052, 1053, 1056, 1057, 1060,
1061, 1064, 1065, 1077, 1078, 1111, 1112, 1119, 1120, 1129, 1130, 1136, 1137,
========= 0 purged address rows (unused) =========
========= 0 address rows updated ========
========= 0 unmatched address rows ========
========= 0 events without country made online =========
========= Dropped 0 duplicated rows =========

Purging caches...
Done in 16 s.

This is working as expected and has updated the DB successfully, sending to product sign off. ๐ŸŽ‰