Skip to content

cli: warn if applied and unapplied migrations are being squashed together #8119

Open
@rikinsk

Description

@rikinsk

Is your proposal related to a problem?

In case some of the migrations being squashed are already applied and some are not, post squashing there is no way to apply the missing parts of the squashed migration to the db (other than running the SQL manually of course) and typically will lead to errors in the next migration apply.

Describe the solution you'd like

Allow squashing migrations only if all the involved migrations are either applied or unapplied. In case an inconsistency is observed, raise a warning to the user mentioning the problem this would create. Also suggest the solution, ie. apply the unapplied migrations on the database before squashing. Allow the user to ignore the warning in case they know what they are doing and have reasons to do so

Describe alternatives you've considered

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions