Custom Search

Thursday, August 21, 2014

How to Backwards migration with Django South

1)
Suppose you have following files in "migrations" folder


0001_initial.py
0002_add_content_type.py
0003_option_to_add_userbookstatus.py


2)
* Run following command to execute the "forwards" method in the migration script 0003_option_to_add_userbookstatus.py

* Run following command to apply the migration script 0003_option_to_add_userbookstatus.py
#./manage.py migrate your_app 0003_option_to_add_userbookstatus.py

3)
* Run following command to execute the "backwards" method in the migration script 0003_option_to_add_userbookstatus.py

* Run following command to revert/rollback the migration script 0003_option_to_add_userbookstatus.py
#./manage.py migrate your_app 0002_add_content_type.py

4)
* Run following command to execute the "backwards" method in the migration script 0002_add_content_type.py
* Run following command to revert/rollback the migration script 0002_add_content_type.py
#./manage.py migrate your_app 0001_initial.py

5)
How to migrate back to 0001_initial.py

#./manage.py migrate your_app zero
or
#./manage.py migrate your_app 0001_initial.py


http://south.readthedocs.org/en/latest/commands.html#migrate

http://stackoverflow.com/questions/5814190/backwards-migration-with-django-south

No comments:

Post a Comment