[Answer]-Django south migration: Reset the schema only few tables

1đź‘Ť

Do it this way:

  1. Open up your terminal and write manage.py dumpdata > backup.json. it will create a json fixture with all data currently in the database. That way, if you screw up anything, you can always re-load the data with manage.py loaddata backup.json (note that all tables need to be empty for this to work).
  2. optional: pass the data to a new development db using the aformentioned loaddata command
  3. Write your own migration, and not worry about breaking anything because – hey, you got a backup. It might take some learning, but the basic idea is you create a migration class with two functions – forward and reverse. Check out the south documentation and pick it up slowly from there.
  4. Come back to SO with any more specific question and troubles you have along the way

This isn’t a coded “here’s the solution” answer, but I hope this helps nonetheless

👤yuvi

Leave a comment