#23410: Backward migrations change overall state rather than reverting single
migration
-----------------------------+------------------------------------
Reporter: Markush2010 | Owner: nobody
Type: New feature | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Comment (by carljm):
Pull request https://github.com/django/django/pull/3562 implements the
simplest version of this.
When migrating backwards, instead of migrating to "just after the named
migration", it migrates to "just before the named migration's immediate
children in the same app".
I think this is more likely to be the desired behavior, and runs less risk
of unintentional rollbacks. When someone names "appA 0001" they are
expressing a desire about which migrations in appA will be
applied/unapplied, not about other apps. They are likely to assume that
migrations in other apps will be applied / rolled back only inasmuch as
needed required to keep dependencies fulfilled. After this PR, that is the
case.
Because of the potential for data loss with unintended rollbacks, I think
this change should be backported to 1.7.X (and I've updated the 1.7.2
release notes accordingly).
There are two other suggestions made in this thread. One is to introduce a
special syntax that means "right before the named migration". I don't
think this is necessary. I think the change made here already provides the
right intuitive behavior for both forwards and backwards migration.
The other is Anssi's suggestion to require a special flag for all
backwards migrations, to even further reduce the likelihood of
unintentional rollback. I think this may be a good idea, but should be
handled in a separate ticket (and should be a new feature in 1.8, not
backported to 1.7).
--
Ticket URL: <https://code.djangoproject.com/ticket/23410#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/069.2164f99e3a1f81142fbfe2e05922a781%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.