Opened 8 years ago

Last modified 8 years ago

#27926 new New feature

Squashmigrations --hard — at Version 1

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 (last modified by Pascal Briet)

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.

Change History (2)

by Pascal Briet, 8 years ago

Attachment: migrations_reset.py added

comment:1 by Pascal Briet, 8 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top