Changes between Version 3 and Version 4 of ConvertingAnApp
- 07/28/09 15:51:27 (4 years ago)
v3 v4 1 1 = Converting An App = 2 3 2 4 3 5 Converting an app to use South is very easy: 4 6 7 8 5 9 - Edit your settings.py and put 'south' into INSTALLED_APPS (assuming you've [wiki:Download installed] it to the right place) 10 6 11 - Run `./manage.py syncdb` to load the South table into the database. Note that syncdb looks different now - South modifies it. 12 13 7 14 8 15 '''If you're running 0.6/trunk:''' 9 16 17 18 10 19 - Run `./manage.py convert_to_south myapp` - South will automatically make and pretend to apply your first migration. 20 21 11 22 12 23 '''If you're running 0.5:''' 13 24 25 26 14 27 - 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. 28 15 29 - 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) 16 30 17 That's it. It's as painless as we could make it, and now your schema changes will be a breeze. Take a look at the [wiki:Documentation documentation] for more on South's workings. 31 32 '''Tips on converting a production app under version control''' 33 34 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: 35 36 - After converting your development apps, commit and push your first migrations to the production server using your preferred vc tool. 37 - run `./manage.py migrate myapp --fake` on production environment to apply the first 'fake' migration. 38 39 40 That's it. It's as painless as we could make it, and now your schema changes will be a breeze. Take a look at the [wiki:Tutorial1 tutorial] or [wiki:Documentation documentation] for more on South's workings.