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 |
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.