Public repository: timo / mitch

Reader

A migration stitcher (therefore mitch) for PostgreSQL, SQLite, MariaDB, and others

mitch / docs / adr / project / project-ids-are-immutable.md · 1.6 KB · at 76a2c3d332a1 · raw


status: accepted

Project IDs are immutable

Once a project has been applied to any deployment, its project ID must not change. Deployments record applied migrations under the project ID, so a renamed project looks like a new one: all its migrations appear pending and up would run them a second time. Mitch offers no rename support. Before an ID has reached a deployment, changing it is harmless.

Considered options

  • former_ids = [...] in mitch.toml. When a deployment's project registry contains a former ID, mitch rewrites it to the current one on the next run. Attractive because it reaches every deployment automatically, including forgotten ones.
  • An explicit rename command per deployment. Rejected: it has to be rolled out by hand to every deployment, and a missed one runs everything twice.
  • Immutable IDs (chosen). No mechanism, nothing to get wrong. The workaround is a manual UPDATE of the project registry on each deployment.

When to revisit

Reconsider former_ids if any of these turns into a real pain:

  • Moving existing projects to globally unique IDs (for example tests-migrations to de.nullachtvierzehn.mitch-tests) after they are already deployed.
  • A project changes owner or organization and its reverse-DNS style ID no longer fits.
  • Two unrelated projects turn out to share an ID and one of them has to give way.
  • A typo in an ID is noticed after deployment.
  • Two projects are merged into one, or one is split, so that migrations move between project IDs.
  • Manual registry updates are being done often enough that people get them wrong.