Opened 8 years ago
Last modified 8 years ago
#27926 new New feature
Squashmigrations --hard — at Initial Version
Reported by: | Pascal Briet | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 1.10 |
Severity: | Normal | Keywords: | squashmigrations |
Cc: | Triage Stage: | Someday/Maybe | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Pull Requests: | How to create a pull request | ||
Description ¶
Here is a suggestion : instead of trying to merge together migrations, start from the models.
It would be a sort of equivalent of applying ./manage.py makemigrations on a project with no migrations.
I reproduced this in a script, and it's working like a charm :
- List all the migrations for every app
- Remove the migration files
- Run makemigrations
- Put a "replaces = []" statement in each one
- Rename them to avoid conflicts.
See script attached. It is surely not the way you would implement it directly in Django, but it might help.
The idea behind it is : not struggling anymore with squashmigrations. Get something clean, and forget about the past.
According to the ticket's flags, the next step(s) to move this issue forward are:
Unknown. The Someday/Maybe triage stage is used to keep track of high-level ideas or long term feature requests.
It could be an issue that's blocked until a future version of Django (if so, Keywords will contain that version number). It could also be an enhancement request that we might consider adding someday to the framework if an excellent patch is submitted.
If you're interested in contributing to the issue, raising your ideas on the Django Forum would be a great place to start.