I have recently updated my model, added a BooleanField to it however when I do python manage.py syncdb
, it doesn\'t add the new field to the database for the mo
Havent used django in a while, but i seem to remember that syncdb does perform alter commands on db tables. you have to drop the table then run again and it will create again.
edit: sorry does NOT perform alter.
Follow these steps:
Django has built in support for migrations - take a look at the documentation.
Django doesn't support migrations out of the box. There is a pluggable app for Django that does exactly that though, and it works great. It's called South.
Django currently does not do this automatically. Your options are:
python manage.py sql (appname)
, find the added line for the field and add it manually using alter table
SQL command. (This will also allow you to choose values of the field for your current records.)In django 1.6
At first we have run - python manage.py sql <app name>
Then we have to run - python manage.py syncdb
If you run Django with Apache and MySQL, restart apache after making migration with makemigrations.