What is the best way to migrate data in django

前端 未结 6 1282
渐次进展
渐次进展 2021-01-30 11:27

After making some changes in my models (eg. new field in a model and a new model) what is the best way of reflecting these changes to my populated database?


PS: I

6条回答
  •  遇见更好的自我
    2021-01-30 11:56

    Another technique is to use the dumpdata and loaddata arguments to manage.py, killing your database in-between:

    1. python manage.py dumpdata > dump.json
    2. With an external tool, drop any affected tables, or kill the whole db
    3. python manage.py loaddata dump.json

    See manage.py docs for more.

提交回复
热议问题