#32267: Unable to unapply a branch of migrations
-----------------------------------------+------------------------
Reporter: Roman Odaisky | Owner: nobody
Type: New feature | Status: new
Component: Migrations | Version: 3.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
1. Check out the master branch of a project into a new branch
2. Implement a feature
3. Make migrations
4. Apply the migrations
5. Merge updates from master into current branch
6. makemigrations --merge
7. Possibly repeat items 2–6 several times
8. Decide to abandon the feature, look for a way to restore the DB to what
the code in master expects
However, there’s no invocation of `manage.py migrate` that will unapply
all the migrations introduced by one branch.
For example:
{{{
master ...---0050---0051a---0052a
\ \
feature 0051b---0052b---0053m
}}}
We’re currently at the merge migration 0053m. We’d like to mark 0053m as
unapplied, perform the rollback operations of 0052b and 0051b and end up
at 0052a (at which point we can check out master and forget about the
existence of the abandoned branch and its migrations). Currently this is
only possible (other than rolling back and re-applying the master
migrations, which may not even be an option) by doing a number of `--fake`
migrations in a risk-prone manner.
There needs to be an option to run `manage.py migrate --before myapp
0051b` or something like that, a command that would rollback the specified
migration and all others that depend on it but leaving ones from parallel
branches unaffected. In other words, while `manage.py migrate myapp 1234`
ensures that 1234 is applied, the suggested command would ensure that the
specified migration is //not// applied (unapplying other migrations where
necessary, but as few as possible).
--
Ticket URL: <https://code.djangoproject.com/ticket/32267>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.9d292acaceef0f17ea08f74ab1522f77%40djangoproject.com.