Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between syncdb and migrate?

I am going through django documentation. And here I have a situation. In one of the documentation, I am told to do

python manage.py migrate

And in the other

python manage.py syncdb

I can't do the first one(Error: no migrate command found.) but second works fine for me. Is this a version issue or I need to take care of something else.

like image 935
Nabin Avatar asked Jan 28 '14 10:01

Nabin


3 Answers

The migrate command is new in the upcoming Django 1.7, which hasn't been released yet.

For earlier versions you can use syncdb, or the external app South.

When you're reading the documentation, use the Documentation version switcher to select the correct version.

For example, the current 1.6 Tutorial uses syncdb, but the dev tutorial (written for the upcoming 1.7) uses migrate.

like image 118
Alasdair Avatar answered Oct 24 '22 10:10

Alasdair


The command migrate belongs to an application called south (http://south.aeracode.org/).

From the website:

This is South, intelligent schema and data migrations for ​Django projects.

Prior to Django==1.7 you had to install a third party application in order to perform database migrations.

Please see documentation at readthedocs

like image 38
wendy_winter Avatar answered Oct 24 '22 10:10

wendy_winter


It depends what version of the documentation you are reading. migrate is the command from South which up until the latest (currently development, or dev) version of django was a separate app. It's finally getting integrated into Django (basically every django project uses it anyway as a matter of course, so it is well worth reading up on).

In the bottom right of the django documentation page there is a selector where you can switch between different versions of Django, so if you're looking for information for your project it is a good idea to change to the version of Django you're currently using.

like image 2
ptr Avatar answered Oct 24 '22 11:10

ptr