#30597 closed Cleanup/optimization (fixed)
Improve documentation on reseting an app's migrations to zero.
Reported by: | Keryn Knight | Owned by: | David Vaz |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
This came on IRC a while back, because someone didn't know how to effectively undo everything they'd done.
The entire documentation that I can find is as follows:
python manage.py migrate --help
says Use the name "zero" to unapply all migrations, and so does this page. That's it.
It's not clear what unapplying migrations means, unless you're familiar with it already - it's not described on this page after searching for "unapply" or "undo" or "reset" or "restart" or "zero", nor is it clarified in the help text for the command, and the process of resetting an app's state to start-from-scratch isn't mentioned at all in the migrations docs, except for this tiny affordance.
Change History (17)
comment:1 by , 5 years ago
Description: | modified (diff) |
---|
follow-up: 3 comment:2 by , 5 years ago
Summary: | Improve documentation on reseting an app's migrations to zero → Improve documentation on reseting an app's migrations to zero. |
---|---|
Type: | New feature → Cleanup/optimization |
comment:3 by , 5 years ago
Thanks for the report. I'm not sure how we could clarify what
"unapplying" migrations
means, it seems clear to me.
You're not the target audience though. Nor am I. All the synonyms I used in searching are ones I might expect new/inexperienced users to be looking for.
Moreover my understanding is that it's not a common use case to unapply all migrations to "zero" state, so I don't think that it deserves a separate section in migrations topics.
That it's uncommon is precisely why it should have documentation beyond the brief throwaway comment* the management command has. It's built in and supported! Every time someone has to do so for the first time, it's either under guidance from someone who knows better, or it's by trial and error. That should not be the case, because there is one way to do it, and one way only, and it's mostly that the concept isn't even discussed which leaves the user out in the cold.
It comes up relatively frequently on IRC that people get their migrations all in a muddle, and usually their answer is to just obliterate their database (sqlite usually) entirely (sometimes rightly, sometimes wrongly). But it's literally a solved problem from the framework's point of view: you can either reset to zero or your migrations and/or schema are so ruined that you need to start over or intervene manually.
* tbh, even South's documentation is better here, though it's almost as throwaway: Note that, if the system has already migrated past the specified migration, it will roll back to it instead. If you want to migrate all the way back, specify the special migration name zero
comment:4 by , 5 years ago
Triage Stage: | Unreviewed → Accepted |
---|
OK, agreed. We can evaluate PR with documentation improvement in this area.
follow-up: 8 comment:7 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:9 by , 5 years ago
Has patch: | set |
---|
comment:10 by , 5 years ago
Patch needs improvement: | set |
---|
comment:14 by , 5 years ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Thanks for the report. I'm not sure how we could clarify what
"unapplying" migrations
means, it seems clear to me. Moreover my understanding is that it's not a common use case to unapply all migrations to "zero" state, so I don't think that it deserves a separate section in migrations topics.migrations topics contains information that
migrate
is responsible for unapplying migrations and also a link to the migrate doc withzero
option (added 6 years ago, see 162f7b938f6cff91b1e4d6086ddcc88cbb1a1cd6).