From c9237c6d50ee0c83299356510a356647faa18879 Mon Sep 17 00:00:00 2001 From: pashko Date: Mon, 17 Jun 2024 23:07:48 +0000 Subject: [PATCH] Update 6 files - /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 - /diff.views/changelog-dir/changelog-master.xml - /pom.xml - /README.md --- README.md | 18 ++- .../changelog-dir/changelog-master.xml | 13 ++ .../cleanup_all_views/01_cleanup-allviews.sql | 7 + .../changelog-dir/changelog-master.xml | 13 ++ diff.views/changelog-dir/changelog-master.xml | 13 ++ pom.xml | 127 +++++++++++------- 6 files changed, 137 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index b559c7f..e218529 100644 --- a/README.md +++ b/README.md @@ -66,17 +66,17 @@ mv diff.tables/changelog-dir/diff-changelog/*.sql diff.tables/changelog-dir/u ``` ```shell -mvn liquibase:update -X > diff.tables/liquibase_log/liquibase_log_update-$(date +%Y%m%d%H%M%S).log +mvn liquibase:update -Denv=diff.tables -X > diff.tables/liquibase_log/liquibase_log_update-$(date +%Y%m%d%H%M%S).log ``` ```shell -mvn liquibase:history > diff.tables/liquibase_log/liquibase_log_history-$(date +%Y%m%d%H%M%S).log +mvn liquibase:history -Denv=diff.tables > diff.tables/liquibase_log/liquibase_log_history-$(date +%Y%m%d%H%M%S).log ``` ### 3. liquibase diff.views script ```shell -mvn liquibase:diff -Denv=diff.views -X > diff.tables/liquibase_log/liquibase_log_diff-$(date +%Y%m%d%H%M%S).log +mvn liquibase:diff -Denv=diff.views -X > diff.views/liquibase_log/liquibase_log_diff-$(date +%Y%m%d%H%M%S).log ``` ```shell @@ -89,13 +89,17 @@ sed -i 's/\x3F/\x3F\x3F/g' changelog-dir/diff-changelog/*.sql ``` ```shell -mv diff.tables/changelog-dir/diff-changelog/*.sql diff.tables/changelog-dir/update-changelog/ +mv diff.views/changelog-dir/diff-changelog/*.sql diff.views/changelog-dir/update-changelog/ ``` ```shell -mvn liquibase:update -X > diff.tables/liquibase_log/liquibase_log_update-$(date +%Y%m%d%H%M%S).log +mvn liquibase:update -Denv=diff.views -X > diff.views/liquibase_log/liquibase_log_update-$(date +%Y%m%d%H%M%S).log ``` ```shell -mvn liquibase:history > diff.tables/liquibase_log/liquibase_log_history-$(date +%Y%m%d%H%M%S).log -``` \ No newline at end of file +mvn liquibase:history -Denv=diff.views > diff.views/liquibase_log/liquibase_log_history-$(date +%Y%m%d%H%M%S).log +``` + +```shell +rm -rf diff.views/changelog-dir/update-changelog/*.sql +``` diff --git a/cleanup.views/changelog-dir/changelog-master.xml b/cleanup.views/changelog-dir/changelog-master.xml index e69de29..03e0918 100644 --- a/cleanup.views/changelog-dir/changelog-master.xml +++ b/cleanup.views/changelog-dir/changelog-master.xml @@ -0,0 +1,13 @@ + + + + + \ 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 e69de29..109d244 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 @@ -0,0 +1,7 @@ +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'; + end loop; +end $$; \ No newline at end of file diff --git a/diff.tables/changelog-dir/changelog-master.xml b/diff.tables/changelog-dir/changelog-master.xml index e69de29..03e0918 100644 --- a/diff.tables/changelog-dir/changelog-master.xml +++ b/diff.tables/changelog-dir/changelog-master.xml @@ -0,0 +1,13 @@ + + + + + \ 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 e69de29..03e0918 100644 --- a/diff.views/changelog-dir/changelog-master.xml +++ b/diff.views/changelog-dir/changelog-master.xml @@ -0,0 +1,13 @@ + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 7e15271..8b9ae7d 100644 --- a/pom.xml +++ b/pom.xml @@ -33,83 +33,116 @@ org.liquibase liquibase-maven-plugin - 4.17.0 + ${liquibase.version} - prod/master.xml - org.postgresql.Driver - dbuser01 - QWEasd759 - jdbc:postgresql://10.2.5.46:5432/db01 - org.postgresql.Driver - jdbc:postgresql://10.2.5.47:5432/db01 - dbuser01 - QWEasd759 - diff + ${profile.propertyFile} + ${profile.changeLogFile} + ${profile.outputChangeLogFile} + ${profile.diffChangeLogFile} prod/data - true - + ${profile.driver} + ${profile.url} + ${profile.defaultSchemaName} + ${profile.changelogSchemaName} + ${profile.drireferenceDriverver} + ${profile.referenceUrl} + ${profile.referenceDefaultSchemaName} + ${goal} + ${profile.verbose} + ${profile.logging} false - - - - + + cleanup.views env - dev + cleanup.views - dev/liquibase.properties - dev/master.xml + cleanup.views/liquibase.properties + cleanup.views/changelog-dir/changelog-master.xml + cleanup.views/changelog-dir/changelog-master.xml + cleanup.views/changelog-dir/diff.views.changelog/liquibase-diifChangeLog-${CI_JOB_NAME}_${CI_PIPLINE_ID} + cleanup.views/data org.postgresql.Driver - dbuser01 - QWEasd759 jdbc:postgresql://10.2.5.47:5432/db01 + public + liquibase org.postgresql.Driver jdbc:postgresql://10.2.5.46:5432/db01 - dbuser01 - QWEasd759 + public diff - dev/data true debug - --> - - + + diff.tables env - prod + diff.tables - - - prod/liquibase.properties - dprod/master.xml + diff.tables/liquibase.properties + diff.tables/changelog-dir/changelog-master.xml + diff.tables/changelog-dir/changelog-master.xml + diff.tables/changelog-dir/diff.changelog/liquibase-diifChangeLog-${CI_JOB_NAME}_${CI_PIPLINE_ID} + diff.tables/data org.postgresql.Driver - dbuser01 - QWEasd759 - jdbc:postgresql://10.2.5.46:5432/db01 + jdbc:postgresql://10.2.5.47:5432/db01 + public + liquibase org.postgresql.Driver - jdbc:postgresql://10.2.5.47:5432/db01 - dbuser01 - QWEasd759 + jdbc:postgresql://10.2.5.46:5432/db01 + public diff - prod/data true debug - - - --> - - \ No newline at end of file + + + + + + + + diff.views + + + env + diff.views + + + + diff.views/liquibase.properties + diff.views/changelog-dir/changelog-master.xml + diff.views/changelog-dir/changelog-master.xml + diff.views/changelog-dir/diff.changelog/liquibase-diifChangeLog-${CI_JOB_NAME}_${CI_PIPLINE_ID} + diff.viewss/data + org.postgresql.Driver + jdbc:postgresql://10.2.5.47:5432/db01 + public + liquibase + org.postgresql.Driver + jdbc:postgresql://10.2.5.46:5432/db01 + public + diff + true + debug + + + + \ No newline at end of file