#32267: Unable to unapply a branch of migrations
-------------------------------+--------------------------------------
     Reporter:  Roman Odaisky  |                    Owner:  nobody
         Type:  New feature    |                   Status:  closed
    Component:  Migrations     |                  Version:  3.1
     Severity:  Normal         |               Resolution:  invalid
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------

Comment (by Mariusz Felisiak):

 > Can we at the very least add something like `manage.py migrate
 --unapply-one <app> <migration>` that would unapply one migration, having
 ensured that no currently applied migrations depend on it? This will solve
 the use case I outlined and maybe some others while not being able to
 corrupt the DB state.

 Migrations can be reversed, see
 [https://docs.djangoproject.com/en/3.1/topics/migrations/#reversing-
 migrations docs]. However adding an option to reverse a specific migration
 doesn't sound like a good idea, we will not be able to ensure that a
 database state is not corrupted. Migrations history must be continuous.
 You're talking about reversing migrations in a database but without
 continuous changes reflected in migrations. So you would like to drop a
 feature branch, reverse its migrations and have a clear path without
 migrations from the feature branch, and yes you can do this but outside of
 Django migrations. The proper way do this in Django is to reverse code
 changes from the feature branch and run `makemigrations` that will create
 a new migration reversing db changes.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32267#comment:4>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.d9487533eea9d2405be0a44569f924ba%40djangoproject.com.

Reply via email to