nodestream
nodestream copied to clipboard
[REQUEST] Squash Migrations
Is your feature request related to a problem? Please describe. Django supports the concept of Squashing Migrations. In general the use case is that, as you are developing pipelines, you may alter the schema as you are developing and thus, generate several migrations. Instead of checking them all in (which would be fine) its preferred to have one migration that represents the aggregate set of changes that you made.
Describe the solution you'd like Imagine something like this:
nodestream migrations squash --from migration-name-1 --to migration-name 2
nodestream migrations squash --from migration-name-1 # leaving off to picks the head migration
Conceptually, I think this means we need to do the following:
- Get the migration graph at each point
- Generate a new migration from those two points
- Discard migrations that are in the
to
graph that are not in thefrom
graph. - Add the new migration to the graph (
from
graph)
Describe alternatives you've considered You can just delete all the migrations that you don't want any more and regenerate the migrations. However, that introduces manual effort to understand the migration graph and feels a little hacky.
Additional context N/A