Last active
August 3, 2024 08:18
-
-
Save ahmedivy/3a9d408f8e87d75c164e786b454a26e2 to your computer and use it in GitHub Desktop.
remove all postgres tables and data
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 = 'my-schema-name') loop | |
execute 'drop table if exists ' || 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