“Q: I have a team of scientists readying articles for our custom Django CMS with lots of numbers and attached units located in their contributions. I would like to offer visitors a way to switch between metric or imperial units.
A: This calls for a social solution: tell them that if they want imperial units they are Not Scientists. ;)”—
reply was off topic … but I love Stack Overflow … :)
These are some wind turbines powering an Antarctic Research Station. And that’s also about as South as you can get in your quest for renewable energy. But today we’re writing about migrating your databases South! Or the following scenario:
You create an übercool insightful Django model. You put some data on it, make some templates, … looks good! And then you realize it wasn’t as cool as you thought. You forgot to add … say the minimum operating temperature for your wind turbines. Bummer! Enter South ( intelligent schema and data migration).
manage.py schemamigration app_name --initial
if you have not done syncdb yet:
manage.py migrate app_name
if you have already done syncdb:
manage.py migrate app_name --fake
Then edit your models.py and add all the fields you forgot to add,
Then create the new migration file and finally migrate the database: