Created
September 23, 2025 05:04
-
-
Save jarrensj/b22b01a117780f1caed7f580ed25501d 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
| -- Drops all tables in the public schema | |
| DO $$ | |
| DECLARE | |
| table_name text; | |
| BEGIN | |
| FOR table_name IN | |
| SELECT tablename | |
| FROM pg_tables | |
| WHERE schemaname = 'public' | |
| LOOP | |
| EXECUTE format('DROP TABLE IF EXISTS %I CASCADE;', table_name); | |
| END LOOP; | |
| END $$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment