Skip to content

Generated migrations: upgrade bound data when the schema changes #127

Description

@matt-edmondson

Split out of #120, item 4, now that items 1 and 2 (path resolution, and loading/validating bound data) have landed.

Problem

When a schema changes, the data files bound to it by a DataSource silently stop conforming. SchemaDataValidator will now report that they no longer conform (#120), but nothing helps a user fix the data.

Scope

Detect schema changes that affect bound data — a renamed, removed or retyped member, a changed enum value — and generate migration code or scripts that upgrade the data in place.

Dependencies

Notes

Renames are the interesting case and are now tractable: as of #112 a rename cascades through the schema, so a diff sees a member renamed rather than one member removed and another added — but only if the rename is recorded. Consider whether the diff can infer renames, or whether the schema needs to retain rename history for data migration to be reliable.

Acceptance criteria

  • Two versions of a schema can be diffed into a set of changes affecting bound data.
  • A migration is generated for renamed, removed and retyped members, and for enum value changes.
  • Data migrated by it validates clean against the new schema.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions