From b0884ade1409e69ea7fecf295c36ce8cc0f75612 Mon Sep 17 00:00:00 2001 From: pashko Date: Mon, 17 Jun 2024 23:26:16 +0000 Subject: [PATCH] Update 5 files - /diff.views/changelog-dir/drop_liquibase_tables/02_drop_liquibase_tables_ceanup.sql - /diff.views/changelog-dir/changelog-master.xml - /cleanup.views/changelog-dir/cleanup_all_views/01_cleanup-allviews.sql - /cleanup.views/changelog-dir/changelog-master.xml - /diff.tables/changelog-dir/changelog-master.xml --- cleanup.views/changelog-dir/changelog-master.xml | 2 +- .../cleanup_all_views/01_cleanup-allviews.sql | 9 ++++++--- diff.tables/changelog-dir/changelog-master.xml | 4 +++- diff.views/changelog-dir/changelog-master.xml | 8 +++++++- .../02_drop_liquibase_tables_ceanup.sql | 2 ++ 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/cleanup.views/changelog-dir/changelog-master.xml b/cleanup.views/changelog-dir/changelog-master.xml index 03e0918..33a1b7d 100644 --- a/cleanup.views/changelog-dir/changelog-master.xml +++ b/cleanup.views/changelog-dir/changelog-master.xml @@ -9,5 +9,5 @@ http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"> - + \ No newline at end of file diff --git a/cleanup.views/changelog-dir/cleanup_all_views/01_cleanup-allviews.sql b/cleanup.views/changelog-dir/cleanup_all_views/01_cleanup-allviews.sql index 109d244..88de8e8 100644 --- a/cleanup.views/changelog-dir/cleanup_all_views/01_cleanup-allviews.sql +++ b/cleanup.views/changelog-dir/cleanup_all_views/01_cleanup-allviews.sql @@ -1,7 +1,10 @@ do $$ declare r record; begin - for r in (select tablename from pg_tables where schemaname = 'my-schema-name') loop - execute 'drop table if exists public.' || quote_ident(r.tablename) || ' cascade'; + for r in (select table_name from information_schema.tables where table_type = 'VIEW' and table_schema = 'public' and table_name != 'pg_stat_statements' and table_name != 'pg_stat_statements_info') loop + execute 'drop view if exists public.' || quote_ident(r.table_name) || ' cascade'; end loop; -end $$; \ No newline at end of file +end $$; + +DROP TABLE IF EXISTS liquibase.datachangelog_views; +DROP TABLE IF EXISTS liquibase.datachangeloglock_views; diff --git a/diff.tables/changelog-dir/changelog-master.xml b/diff.tables/changelog-dir/changelog-master.xml index 03e0918..44b55ef 100644 --- a/diff.tables/changelog-dir/changelog-master.xml +++ b/diff.tables/changelog-dir/changelog-master.xml @@ -9,5 +9,7 @@ http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"> - + + + \ No newline at end of file diff --git a/diff.views/changelog-dir/changelog-master.xml b/diff.views/changelog-dir/changelog-master.xml index 03e0918..4ebf6d2 100644 --- a/diff.views/changelog-dir/changelog-master.xml +++ b/diff.views/changelog-dir/changelog-master.xml @@ -9,5 +9,11 @@ http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"> - + + + + + + + \ No newline at end of file diff --git a/diff.views/changelog-dir/drop_liquibase_tables/02_drop_liquibase_tables_ceanup.sql b/diff.views/changelog-dir/drop_liquibase_tables/02_drop_liquibase_tables_ceanup.sql index e69de29..d04a8f8 100644 --- a/diff.views/changelog-dir/drop_liquibase_tables/02_drop_liquibase_tables_ceanup.sql +++ b/diff.views/changelog-dir/drop_liquibase_tables/02_drop_liquibase_tables_ceanup.sql @@ -0,0 +1,2 @@ +DROP TABLE IF EXISTS liquibase.datachangelog_cleanup; +DROP TABLE IF EXISTS liquibase.datachangeloglock_cleanup; \ No newline at end of file