How to delete django migrations after squashing them? -


django documentation says delete migrations after squashing them:

you should commit migration leave old ones in place; new migration used new installs. once sure instances of code base have applied migrations squashed, can delete them.

here, deleting means deleting migration files, or entries in django_migrations table well?

here background: have development machine, 1 code base. after squashing of migrations had applied, deleted files , database entries. tested if ok making migrations, did not find anything. so, looked good. next day, had change something, , made migration. when tried migrate, tried apply squashed migration (which applied part part before being squashed). so, had go , recreate entries in django_migrations table. so, seems had keep database entries. trying make sure before mess again, , understand why looked fine first, , tried apply squashed migration.

squashed migrations never marked applied, fixed in 1.8.3 (see #24628).

the steps remove old migrations are:

  1. make sure replaced migrations applied (or none of them).
  2. remove old migration files, remove replaces attribute squashed migrations.
  3. (workaround) run ./manage.py migrate <app_label> <squashed_migration> --fake.

the last step won't necessary when 1.8.3 arrives.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -