What is the django command to delete all tables?

前端 未结 7 1985
清歌不尽
清歌不尽 2021-01-31 16:47

Are there django commands that

A. Delete all tables

B. delete all data in all tables

C. Create all tables as defined in the model?

7条回答
  •  被撕碎了的回忆
    2021-01-31 16:57

    And a simpler oneliner to drop all the tables for django 1.5+:

    python2 manage.py sqlflush | sed 's/TRUNCATE/DROP TABLE/g'| python2 manage.py dbshell
    

提交回复
热议问题