Skip to content

Add update script migrating location fields to 7.0 #196

Description

@edalzell

Final piece of #190 — customers upgrading to 7.0 shouldn't hand-edit content.

src/UpdateScripts/MigrateLocationFields.php, same pattern as ConvertConfigToSettings: shouldUpdate()$this->isUpdatingTo('7.0').

Migration

Iterate entries in Events::setting('collections'), all localizations. Events-owned handles only → nested location group shape from #195:

Old New
address (string) location.name
non-URL string location location.name
URL string location online_url
link online_url
top-level coordinates location.coordinates

Then remove the old handles. Preserve an existing online_url if already set when migrating link / URL-location.

Never touch a non-string / foreign location. Array-shaped values belong to Prime/Simple (details, etc.) — Prime migrates in transformstudios/prime#834. Log entry IDs and skip.

Ambiguous cases — log and skip (list IDs):

  • address and a non-URL string location both set (today address wins for LOCATION:)
  • link and a URL-valued location both set
  • online_url already set and a conflicting link / URL-location

Tests

TDD. tests/UpdateScripts/MigrateLocationFieldsTest.php:

  • each row moves to the nested / online_url target; old handles removed
  • ambiguous cases logged, entry untouched
  • array-shaped location untouched
  • top-level coordinates move under location.coordinates
  • multi-site localizations
  • shouldUpdate() true for 6→7 and 5→7; false within 6.x or 7.x

Docs

Finish 7.0 upgrade notes from #195: what migrates, what skips, back-up-first, computed-value mappings are manual.

Branch

feature/migrate-location-fields off main. Needs #195.

Part of #190.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions