|Version 5 (modified by andrew, 6 years ago) (diff)|
Converting An App
Converting an app to use South is very easy:
- Edit your settings.py and put 'south' into INSTALLED_APPS (assuming you've installed it to the right place)
- Run ./manage.py syncdb to load the South table into the database. Note that syncdb looks different now - South modifies it.
If you're running 0.6/trunk:
- Run ./manage.py convert_to_south myapp - South will automatically make and pretend to apply your first migration.
If you're running 0.5:
- Run ./manage.py startmigration myapp --initial - this will create a migrations directory and a first migration that will create the schema you currently have in models.py.
- Run ./manage.py migrate myapp to use South to make the tables. If you've already syncdb'd this app, you can run ./manage.py migrate myapp --fake to trick South into thinking the migrations are already applied (the tables are created, so technically they are, it's just that South didn't make them so it needs informing)
Tips on converting a production app under version control
The convert_to_south command expects to find no existing migrations in your migrations folder so run it on your production environment before you push your initial development database migration to production. Alternatively:
- After converting your development apps, commit and push your first migrations to the production server using your preferred vc tool.
- Run ./manage.py migrate myapp --fake on production environment to apply the first 'fake' migration.