kmalmur kmalmur - 3 years ago 237
SQL Question

Django drop all tables from database

How can I drop all tables from a database using and command line? Is there any way to do that executing with appropriate parameters so I can execute it from a .NET application?

Answer Source

AFAIK there is no management command to drop all tables. If you don't mind hacking Python you can write your own custom command to do that. You may find the sqlclear option interesting. Documentation says that ./ sqlclear Prints the DROP TABLE SQL statements for the given app name(s).

Update: Shamelessly appropriating @Mike DeSimone's comment below this answer to give a complete answer.

./ sqlclear | ./ dbshell
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download