Search code examples
pythondjangomigrationdjango-south

Move package with migrations in django


How to move package from one place to another in Django (1.4) with south? Package has applied migrations.


Solution

  • As far as I know there is no automatic way to do that, so you'll have to do the following by hand:

    1. Move your package to the new place
    2. Reflect this change in your settings.py INSTALLED_APPS
    3. In all the migration files of you package you have to edit the module path, table names and complete_apps list
    4. In your database table south_migrationhistory you have to edit the app_name column
    5. Rename the app table(s) in the database

    That's all. To check that everything is working properly you can type python manage.py schemamigration your_new_app_name --auto and if you did everything properly it will say that nothing have changed. Now you can continue working with your app as usual.