nodestream icon indicating copy to clipboard operation
nodestream copied to clipboard

[REQUEST] Squash Migrations

Open zprobst opened this issue 9 months ago • 0 comments

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 the from 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

zprobst avatar Apr 29 '24 14:04 zprobst