Created
August 11, 2025 12:48
-
-
Save BacLuc/61a0ece302e81fd1473e461741fdf215 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 as entry | |
| FROM pg_tables | |
| WHERE | |
| schemaname = current_schema()) | |
| LOOP | |
| EXECUTE 'DROP TABLE ' || quote_ident(r.entry) || ' CASCADE'; | |
| END LOOP; | |
| END $$; | |
| DO $$ DECLARE | |
| r RECORD; | |
| BEGIN | |
| FOR r IN ( | |
| SELECT sequencename as entry | |
| FROM pg_sequences | |
| WHERE | |
| schemaname = current_schema()) | |
| LOOP | |
| EXECUTE 'DROP SEQUENCE ' || quote_ident(r.entry) || ''; | |
| END LOOP; | |
| END $$; | |
| DO $$ DECLARE | |
| r RECORD; | |
| BEGIN | |
| FOR r IN ( | |
| SELECT viewname as entry | |
| FROM pg_views | |
| WHERE | |
| schemaname = current_schema()) | |
| LOOP | |
| EXECUTE 'DROP VIEW ' || quote_ident(r.entry) || ''; | |
| END LOOP; | |
| END $$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment