0

I set a key that I have now realizes is wrong. It is set at migration 0005. The last migration I did was 0004. I'm now up to 0008. I want to rebuild the migrations with the current models.py against the current database schema. Migration 0005 is no longer relevant and has been deleted from models.py. Migration 0005 is also an IntegrityError, so it cannot be applied without deleting data that shouldn't be deleted.

How do I get past migration 0005 so I can migrate?

Savad KP
  • 1,625
  • 3
  • 28
  • 40
User
  • 23,729
  • 38
  • 124
  • 207
  • 3
    If 0005 has not been applied yet, can't you delete migrations 0005-0008, and then run `makemigrations` again? – user2390182 Dec 29 '15 at 00:16
  • @schwobaseggl yeah, how do I do that? – User Dec 29 '15 at 00:36
  • 3
    You delete the actual files from the `migrations` folder. If any migrations beyond 0004 have already been applied, you can try to unapply them by running `migrate 0004`. This might or might not work, however, depending on the nature of those migrations. – user2390182 Dec 29 '15 at 00:49
  • @schwobaseggl do I need to delete anything from the migration table? – User Dec 29 '15 at 00:54
  • look for `squashmigrations` – P3zhman Dec 29 '15 at 07:50

1 Answers1

0

Simply delete 0005-0008 migration files from migrations/ folder. Re. database tables, you won't need to delete anything from there if migrations weren't applied. You can check yourself django_migrations table entries to be sure.