Migration bug in 1.9.5?

45 views
Skip to first unread message

Aaron C. de Bruyn

unread,
Apr 12, 2016, 6:25:51 PM4/12/16
to django...@googlegroups.com
* My project has been around since the Django 1.2 days.
* Some time around 1.8.x I ran squashmigrations and everything worked perfectly.
* I've done lots of migrations since then.
* I updated the app to Python 3.
* Everything was working perfectly

I just did my first makemigration under python 3.  Specifically I added a Boolean 'enabled' field to a model.

The migration appears to have been created properly, but when I try to run the 'migrate' command, it tries to apply 0001_squashed_0009_auto_20150109_1447.

I tried to fake it by running 'manage.py migrate myapp 0001 --fake' and it says it applied (faked).
Running 'manage.py migrate' shows it trying to apply the 0001_squashed... migration again.

I also tried using the --fake-initial flag with no luck.

'showmigrations' show every migration since the squash has been applied, just not the squashed migration or the most recent one I just created:

myapp
 [ ] 0001_squashed_0009_auto_20150109_1447 (9 squashed migrations)
 [X] 0010_auto_20150109_1824
 [X] 0011_auto_20150818_1946
 [X] 0012_auto_20150829_1610
 [X] 0013_auto_20150829_1610
 [X] 0014_auto_20150829_1618
 [X] 0015_auto_20150829_1618
 [X] 0016_remove_internetprovider_old_phone
 [X] 0017_office_linked_location
 [X] 0018_auto_20150829_2345
 [X] 0019_office_pib_version
 [X] 0020_auto_20150908_1643
 [X] 0021_internetservice_notes
 [X] 0022_office_last_router_backup_alert
 [ ] 0023_auto_20160412_1433

How can I get the system to recognize that 0001_squashed... has been applied already?

Thanks,

-A

Tim Graham

unread,
Apr 13, 2016, 8:18:33 AM4/13/16
to Django users
It looks like your migration history is corrupted somehow (migrations 10-22 are applied but not their dependency 0001). You might need to manually add a row to the django_migrations table to reflect the fact that 0001 is applied. If you can provide steps that reproduce how you got to such a bad state, please open a ticket with details.
Reply all
Reply to author
Forward
0 new messages