On Tuesday 01 December 2015 08:40:34 Andrew Godwin wrote:
> You can undo a migration manually using migrate, though if you're in
> multiple-tip-migration scenario you may need to make a merge migration
> first (but not apply it) or switch to a branch with only the migration you
> wish to undo.
>
Yep. But this is highly unintuitive: "To fix it, first make things worse".
> The more general rebase command would be interesting, though I've always
> been wary about adding one, as it's not a guarantee we can always keep -
> some operations are irreversible, and in Django's case, a migration may not
> be undoable without other related migrations for foreignkeys, so deleting a
> migration would likely require deletion of those target migrations as well,
> potentially?
>
Oh, I'd definitely not want that. If, in order to rebase a migration, I'd find
that I need to roll other migrations back, I'd expect the rebase to fail.
Similarly, if I get my "conflict-resistant undo", I'd expect it to require that
the migration can be rolled back on its own. If others are dependent on it,
they should be rolled back explicitly -- I'd really like to minimize automatic
decision-making in a less-than-stable state.
Shai.