Forked from kagundajm/postgresql-drop-all-tables.sql
Created
December 31, 2021 08:32
-
-
Save anilktechie/6458db4a72841a20310afb09a2201fc5 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 table_name | |
| FROM information_schema.tables | |
| WHERE table_schema=current_schema() | |
| ) | |
| LOOP | |
| EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.table_name) || ' CASCADE'; | |
| END LOOP; | |
| END $$ ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment