Page MenuHomePhabricator

Country of event data migration (free text -> code; optional -> required; remove country from address)
Closed, ResolvedPublic

Description

This task outlines a roadmap for updating the database and storage layer so that the "event country" field:

  1. Uses a valid country code instead of free text
  2. Becomes required
  3. Is no longer repeated inside the "full address" field

See https://www.mediawiki.org/wiki/User:ASarabadani_(WMF)/Database_for_devs_toolkit/How-to/Data_migration for a detailed description of individual steps, as well as the code documentation for the migration stages.

Roadmap

(Note, these steps should be done roughly in order)

  • T397269 Create a DB column for the country code, wait for it to exist in beta and production.
  • T397544 Add a migration flag to the code, which should default to MIGRATION_OLD.
  • T397270 Write a script to backfill the new schema from old data. (This will be run later on)
  • Test the script in production using dry-run. Iterate on the script (e.g., adding more special cases as needed and fixing bugs: T397270).
  • Confirm that we will force a default value (or make the event not in-person) for events that either have no country, or have a country that we can't automatically convert to a country code.
  • T397636 Start purging unused address rows.
  • T397273 Update the storage layer code so that everything country-related (reads and writes) works for all the possible migration flag combinations.
  • T397867 Update the entity layer (EventRegistration, Address, EventFactory) so that everything country-related (reads and writes) works for all the possible migration flag combinations.
  • Update UI and API code to work for all possible migration stages:
  • Wait for the updated code (all tasks above) to reach production
  • Set the migration stage to MIGRATION_WRITE_BOTH as default in tests that use MIGRATION_OLD: r1173933
  • Set the migration stage to MIGRATION_WRITE_BOTH in production, make sure it works. r1175507
  • Run the migration script on all the DBs used by CampaignEvents, make sure it worked
  • Set the migration stage to MIGRATION_WRITE_NEW as default in tests that use MIGRATION_WRITE_BOTH. r1175508
  • T401336 Bump the default migration stage to MIGRATION_WRITE_BOTH
  • T401336 Add the update script to update.php
  • Set the migration stage to MIGRATION_WRITE_NEW in production, make sure it works. r1180858
  • Set the migration stage to MIGRATION_NEW as default in tests that use MIGRATION_WRITE_NEW. r1180889
  • Set the migration stage to MIGRATION_NEW in production, make sure it works. r1180890
  • Wait for the MW 1.45 branch cut (first release after we introduced the migration flag), due 2025-10-28
  • T408931 Clean up the old schema: make the new column not nullable, drop the old column. Make sure the change is applied in beta and production.
  • T408932 Drop the migration flag and associated code + misc clean-ups (e.g. make things not nullable in the code; drop temporary methods; make sure in-person/hybrid events have an Address object; perhaps add a getAddressOfOnlineEvent() for type safety that returns Address or throws; etc.)

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Daimona updated the task description. (Show Details)

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

[mediawiki/extensions/CampaignEvents@master] tests: Bump country migration stage to WRITE_BOTH

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

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

[operations/mediawiki-config@master] Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_WRITE_BOTH

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

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

[mediawiki/extensions/CampaignEvents@master] tests: Bump country migration stage to MIGRATION_WRITE_NEW

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

Change #1173933 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] tests: Bump country migration stage to WRITE_BOTH

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

Change #1175508 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] tests: Bump country migration stage to MIGRATION_WRITE_NEW

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

Change #1175507 merged by jenkins-bot:

[operations/mediawiki-config@master] Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_WRITE_BOTH

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

Mentioned in SAL (#wikimedia-operations) [2025-08-04T14:12:35Z] <lucaswerkmeister-wmde@deploy1003> Started scap sync-world: Backport for [[gerrit:1175507|Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_WRITE_BOTH (T397476)]]

Mentioned in SAL (#wikimedia-operations) [2025-08-04T14:16:41Z] <lucaswerkmeister-wmde@deploy1003> daimona, lucaswerkmeister-wmde: Backport for [[gerrit:1175507|Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_WRITE_BOTH (T397476)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-08-04T14:28:52Z] <lucaswerkmeister-wmde@deploy1003> Finished scap sync-world: Backport for [[gerrit:1175507|Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_WRITE_BOTH (T397476)]] (duration: 16m 17s)

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 #1176263 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Fix EventStoreTest implicitly relying on default country migration stage

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

Change #1176263 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Fix EventStoreTest implicitly relying on default country migration stage

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

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

[operations/mediawiki-config@master] Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_WRITE_NEW

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

Change #1180858 merged by jenkins-bot:

[operations/mediawiki-config@master] Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_WRITE_NEW

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

Mentioned in SAL (#wikimedia-operations) [2025-08-21T13:16:53Z] <urbanecm@deploy1003> Started scap sync-world: Backport for [[gerrit:1180858|Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_WRITE_NEW (T397476)]]

Mentioned in SAL (#wikimedia-operations) [2025-08-21T13:21:20Z] <urbanecm@deploy1003> urbanecm, daimona: Backport for [[gerrit:1180858|Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_WRITE_NEW (T397476)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-08-21T13:30:55Z] <urbanecm@deploy1003> Finished scap sync-world: Backport for [[gerrit:1180858|Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_WRITE_NEW (T397476)]] (duration: 14m 01s)

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

[mediawiki/extensions/CampaignEvents@master] tests: Bump country migration stage to MIGRATION_NEW

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

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

[operations/mediawiki-config@master] Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_NEW

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

Change #1180889 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] tests: Bump country migration stage to MIGRATION_NEW

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

Change #1180890 merged by jenkins-bot:

[operations/mediawiki-config@master] Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_NEW

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

Mentioned in SAL (#wikimedia-operations) [2025-09-09T20:22:46Z] <cjming@deploy1003> Started scap sync-world: Backport for [[gerrit:1180890|Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_NEW (T397476)]]

Mentioned in SAL (#wikimedia-operations) [2025-09-09T20:28:50Z] <cjming@deploy1003> cjming, daimona: Backport for [[gerrit:1180890|Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_NEW (T397476)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-09-09T20:38:31Z] <cjming@deploy1003> Finished scap sync-world: Backport for [[gerrit:1180890|Set wgCampaignEventsCountrySchemaMigrationStage to MIGRATION_NEW (T397476)]] (duration: 15m 45s)

Daimona changed the task status from Open to Stalled.Sep 10 2025, 11:26 PM

Marking as blocked as it's now waiting for the 1.45 branch cut, set to happen in October (I think). Leaving this in the sprint board so it doesn't completely fall off the radar.

REL1_45 has been cut, so this is now unblocked.

Daimona changed the task status from Stalled to Open.Oct 30 2025, 4:14 PM

This can be resolved once the two remaining subtasks are closed.