I have database in PostgreSql named “tests”.
And i want to write sh script to syncdb it with django, run tests and then drop all tables.
Can anyone suggest a proper solution?
A bit of script:
DJANGO_DATABASE='tests' bin/django-admin.py syncdb
bin/django-admin.py test MyApplication #tests will use "tests" db
sudo su postgres
psql tests
drop schema public; #i think i can drop schema and then syncdb.. or i'm wrong.
exit
As far as i know, django can do this for you. <– outdated
Actually, it changed a bit :).
But it’s still possible:
this will pipe, the output of
sqlclearmanagement-command into thedbshell.which will in turn execute it.
sqlclearwill outputDROP TABLE ...sql-statements.