开发者

Django db reset without loading fixtures

开发者 https://www.devze.com 2022-12-09 23:29 出处:网络
Is there an easy way to reset a django database (i.e. drop all data/tables, create new tables and create indexes) without loading fixture data afterwords? What I want to have is just an empty database

Is there an easy way to reset a django database (i.e. drop all data/tables, create new tables and create indexes) without loading fixture data afterwords? What I want to have is just an empty database because all data is loaded from another source (a kind of a post-processed backup).

I know that this could be achieved by piping the output of the manag开发者_运维知识库e sql... commands to manage dbshell, but this relies on manage dbshelland is kind of hacky...

Are there any other ways to do this?

Edit: manage reset will do it, but is there a command like reset that doesn't need the application names as parameters?


As far as I know, the fixtures (in initial_data file) are automatically loaded after manage.py syndcb and not after reset. So, if you do a manage.py reset yourapp it should not load the fixtures. Hmm?


shouldn't you be able do do this with manage.py's reset option?

0

精彩评论

暂无评论...
验证码 换一张
取 消