I'm new to South so I am wondering if I ever need to call
./manage.py syncdb
or doing
./manage.py schemamigration appname --auto
./manage.py migrate appname
is sufficient in all cases South can handle on its own.
South isn't project wide. It is app wide.
Some apps use south, some apps don't use it.
if an app is integrated south, to do db changes you will use
./manage.py schemamigration appname --auto
./manage.py migrate appname
but not all apps are integrated with south.
When you add a new app that don't use south to your project, you need to call ./manage.py syncdb
for these apps. (For example, django.contrib
apps)
In short, use ./manage.py syncdb
when an app doesn't use south, and ./manage.py migrate
for south integrated apps.
When you create or install a new app MyApp, you should first execute the following commands:
./manage.py schemamigration MyApp --inital
./manage.py migrate MyApp
After that whenever you execute ./manage.py syncdb
you will see:
Syncing...
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
Synced:
> south
> django.contrib.auth
> django.contrib.contenttypes
> django.contrib.sessions
> django.contrib.sites
> django.contrib.messages
> django.contrib.staticfiles
> django.contrib.admin
> django.contrib.admindocs
Not synced (use migrations):
- MyApp
(use ./manage.py migrate to migrate these)
You can see that manage.py syncdb
is able to differentiate between apps managed by South (Not synced
section) and those not managed by South (Synced
section). It also reminds you to use ./manage.py migrate
.
The important point is to let South manage a new app by executing ./manage.py schemamigration MyApp --inital
and ./manage.py migrate MyApp
before executing ./manage.py syncdb
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With