Support composable migration sources and an upper migration target #17902
cbratschi
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
Reusable Payload packages and plugins can own database changes while the consuming application also owns project-specific migrations.
Payload currently accepts one
migrationDir. RuntimeprodMigrationscan receive a manually combined array, but the migration runner executes every pending migration in that array. There is no supported way to stop at the last migration approved for a particular application release.Our current workaround is to aggregate migrations into the application and manually filter the registered production migrations. This loses source ownership and makes it easy for an application to run migrations beyond its intended release boundary.
Proposed contract
It would be useful to separate three concepts:
migrate:create.For example:
The corresponding programmatic and production migration APIs should support the same target.
Expected behavior
migrate:createwriting to one explicitly configured application directory.The open v4 CLI work in #17604 appears to provide a natural place for a typed
toinput, but the underlying adapter migration contract would also need to support it.I'd be happy to help with API design, tests, or implementation once the desired source-ordering and target semantics are agreed.
All reactions