What should I use instead of syncdb in Django 1.9?

syncdb is deprecated because of the migration system, introduced with django 1.7.

Now you can track your changes using makemigrations. This transforms your model changes into python code to make them deployable to another databases. When you have further modifications you need applied to the database, you can use data migrations.

After you created the migrations you have to apply them: migrate.

So instead of using syncdb you should use makemigrations and then migrate.

Workflow on development after you changed something in your models:

./manage.py makemigrations
./manage.py migrate

And on your production system:

./manage.py migrate

Bonus: you do not need to run migrate for each change. If you have multiple changes not applied yet django will run them in the correct order for you.

Leave a Comment