1đź‘Ť
Do it this way:
- 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 withmanage.py loaddata backup.json
(note that all tables need to be empty for this to work). - optional: pass the data to a new development db using the aformentioned
loaddata
command - 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.
- 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
Source:stackexchange.com