Created
March 24, 2020 03:57
-
-
Save bokwoon95/a0ddc023cb543786e9b341f252d7fec8 to your computer and use it in GitHub Desktop.
drop all tables in public schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DO $$ DECLARE | |
r RECORD; | |
BEGIN | |
FOR r IN | |
SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname = 'public' | |
LOOP | |
EXECUTE 'DROP TABLE ' || quote_ident(r.tablename) || ' CASCADE'; | |
END LOOP; | |
END $$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment