Nabin
Nabin

Reputation: 11776

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.

Upvotes: 12

Views: 7600

Answers (3)

Alasdair
Alasdair

Reputation: 309009

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.

Upvotes: 7

wendy_winter
wendy_winter

Reputation: 541

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

Upvotes: 6

ptr
ptr

Reputation: 3384

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.

Upvotes: 2

Related Questions