Last active
August 14, 2022 12:27
-
-
Save knopki/63a9bc625864ee3b4b3aeb0e0ddfd884 to your computer and use it in GitHub Desktop.
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_tables WHERE schemaname = current_schema()) LOOP | |
| EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.tablename) || ' CASCADE'; | |
| END LOOP; | |
| FOR r IN (SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema()) LOOP | |
| EXECUTE 'DROP SEQUENCE IF EXISTS ' || quote_ident(r.sequence_name); | |
| END LOOP; | |
| END $$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment