我想在 Django 中获取所有应用程序的 sql 清晰代码。我可以使用./manage.py sqlclear
,但我需要指定一个应用程序名称,因此仅适用于一个应用程序。
有没有办法或命令来执行sqlclear
所有已安装的应用程序?
Django 扩展有reset_db
很方便的命令。
样品运行:
(junction)➜ junction git:(master) ✗ ./manage.py reset_db
Monkey patching...
You have requested a database reset.
This will IRREVERSIBLY DESTROY
ALL data in the database "/Users/kracekumar/code/junction/db.sqlite3".
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
Reset successful.