How can I drop all tables from database using mannage.py and command line? Is there any way to do that executing manage.py with appropriate parameters so that to execute it from .NET application?
+1
A:
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 ./manage.py sqlclear
Prints the DROP TABLE SQL statements for the given app name(s).
Manoj Govindan
2010-08-05 11:48:19
sqlclear "prints the drop statements" but how to execute them in single command line call
mack369
2010-08-05 12:28:45
Pipe it to `./manage.py dbshell`.
Mike DeSimone
2010-08-05 13:36:15
+1
A:
If you're using the South package to handle database migrations (highly recommended), then you could just use the ./manage.py migrate appname zero
command.
Otherwise, I'd recommend the ./manage.py dbshell
command, piping in SQL commands on standard input.
Mike DeSimone
2010-08-05 11:56:41