SP/web2py/scripts/drop-pgsql-tables.sh

14 lines
293 B
Bash
Raw Normal View History

2018-10-25 15:33:07 +00:00
# first, login with psql
psql -U USERNAME -d databasename
# set output for all queries
\o FILENAME.sql
# run this query
select 'drop table ' || tablename || ' cascade;' from pg_tables;
# logout from psql
\q
# run sql script from commandline
psql -U USERNAME -d databasename -f FILENAME.sql