Note to Self: More on South

Setup being along the dev → test → prod lines, to correctly manage database migrations we first set things up at dev:

manage.py syncdb --noinput
manage.py convert_to_south <app>
manage.py createsuperuser

At this point the South migrations are being pushed to repository and pulled in at test:

manage.py syncdb --noinput
manage.py migrate
manage.py migrate <app> 0001 --fake
manage.py createsuperuser

Now, back at dev, after a change to one of the models:

manage.py schemamigration <app> --auto
manage.py migrate <app>
And, after push/pull, at test:
manage.py migrate <app>

Tagged with:

Categorised as:


Note to self: Django/South basic usage

Not that I understand how this schema migration thing actually works. Anyway, initially, on an empty database:
./manage.py syncdb --noinput
./manage.py schemamigration YOUR_APP --initial
./manage.py migrate YOUR_APP 0001 --fake
Then, after fiddling with your models:
./manage.py schemamigration YOUR_APP --auto
./manage.py migrate YOUR_APP
That should do it. But like I said, my understanding of the system is very limited and I'm sure there are cases when this simplistic pattern just won't cut it. My needs, however, at the moment are not the most complicated.

Tagged with:

Categorised as: