Last active
March 7, 2019 11:57
-
-
Save jitscar/9aad1ce80d803937e1597a9c8261b1a1 to your computer and use it in GitHub Desktop.
Clean all data in PostreSql db
This file contains 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 | |
l_stmt text; | |
begin | |
select 'TRUNCATE ' || string_agg(format('%I.%I', schemaname, tablename), ',') | |
into l_stmt | |
from pg_tables | |
where schemaname in ('public', 'sources'); | |
execute l_stmt || ' CASCADE'; | |
end; | |
$$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment