Django 1.7 - makemigrations not detecting changes

前端 未结 29 1522
忘了有多久
忘了有多久 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条回答
  •  旧时难觅i
    2020-11-27 12:59

    The answer is on this stackoverflow post, by cdvv7788 Migrations in Django 1.7

    If it is the first time you are migrating that app you have to use:

    manage.py makemigrations myappname Once you do that you can do:

    manage.py migrate If you had your app in database, modified its model and its not updating the changes on makemigrations you probably havent migrated it yet. Change your model back to its original form, run the first command (with the app name) and migrate...it will fake it. Once you do that put back the changes on your model, run makemigrations and migrate again and it should work.

    I was having the exact same trouble and doing the above worked perfectly.

    I had moved my django app to cloud9 and for some reason I never caught the initial migration.

提交回复
热议问题