Search code examples
djangodatabasedjango-modelsdjango-southdjango-database

Accidentally deleted my django south migration directory


I accidentally deleted the South migrations directory for one of my Django apps. This directory was not under git.

So now there are migrations in the database that are not present on the disk.

Some pointers on how I can recover from this will be much appreciated.


Solution

  • Without the option of any type of backup or finding the files somewhere, what you're going to have to do is make initial migrations and then fake them.

    $ ./manage.py schemamigration app --initial
    $ ./manage.py migrate app --fake
    

    This will get you to where you are currently, however you won't have the option to migrate backwards.