I'm just learning Django. I am eating my own dogfood by using my app while I am developing it. I will be adding data to my database constantly, and I expect that my models will change over time. How do I keep my data while changing my models?
I realize that this is not something that Django can just "do for 开发者_运维百科me". I'm willing to write code to adapt between the old model and the new model. I'm just wondering what the recommended way to do that is. Given that I will be changing my models fairly frequently, what is the simplest and most robust way to transition the data?
Thanks.
You need to look at South. this app will allow you to define "migrations" to your schema that let you change the layout of the database and even migrate data between different formats in between.
South has one major drawback. When you decide to change a field name in your model (e.g. from descriptions to description) all the data in the column will be lost (south will delete column desciptions and create description instead of altering the column's name).
精彩评论