Django 1.7 - makemigrations not detecting changes

前端 未结 29 1516
忘了有多久
忘了有多久 2020-11-27 12:43

As the title says, I can\'t seem to get migrations working.

The app was originally under 1.6, so I understand that migrations won\'t be there initially, and indeed i

29条回答
  •  悲哀的现实
    2020-11-27 13:01

    Adding my 2c, since none of these solutions worked for me, but this did...

    I had just run manage.py squashmigrations and removed the old migrations (both the files and lines in the the django.migrations database table).

    This left a line like this in the last migration file:

    replaces = [(b'my_app', '0006_auto_20170713_1735'), (b'my_app', '0007_auto_20170713_2003'), (b'my_app', '0008_auto_20170713_2004')]
    

    This apparently confused Django and caused weird behavior: running manage.py makemigrations my_app would recreate the initial migration as if none existed. Removing the replaces... line fixed the problem!

提交回复
热议问题