반응형

https://stackoverflow.com/questions/3327312/how-can-i-drop-all-the-tables-in-a-postgresql-database

 

How can I drop all the tables in a PostgreSQL database?

How can I drop all tables in PostgreSQL, working from the command line? I don't want to drop the database itself, just all tables and all the data in them.

stackoverflow.com

DROP SCHEMA public CASCADE;
CREATE SCHEMA public;

 

If you are using PostgreSQL 9.3 or later, you may also need to restore the default grants.

GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO public;
반응형

+ Recent posts