Search code examples
djangodjango-modelsdjango-south

What is the best approach for migrating one Django app to another


I am working on a Django project where I have to use South to migrate one application to another. I have the old internal message application which I have to replace by another completely different. I was wondering if I could pass by orm, but the old application doesn't exist anymore in the INSTALLED_APPS, so no sense. Does using a SQL procedure is the way to do that? I'd like to keep the application DB type independant at the time.


Solution

  • Django applications are namespaced in the database so you ought to be able to temporarily have both applications installed. I would break it down to about three migrations:

    1. A schemamigration to add the new application. If other applications need to have foreign key relations to the new application, add those and just make sure they are all nullable.
    2. A datamigration to walk the model objects in the old application and create the equivalent ones in the new application.
    3. A schemamigration to remove the old application.