From 28d7981f4ebd40771305144ddafd9866ff2d6644 Mon Sep 17 00:00:00 2001 From: pashko Date: Mon, 17 Jun 2024 21:39:46 +0000 Subject: [PATCH] Update 12 files - /target/liquibase/migrate.sql - /prod/liquibase.properties - /dev/liquibase.properties - /README.md - /cleanup.views/changelog-dir/changelog-master.xml - /cleanup.views/changelog-dir/cleanup_all_views/01_cleanup-allviews.sql - /cleanup.views/liquibase.properties - /diff.tables/changelog-dir/changelog-master.xml - /diff.tables/liquibase.properties - /diff.views/changelog-dir/changelog-master.xml - /diff.views/changelog-dir/drop_liquibase_tables/02_drop_liquibase_tables_ceanup.sql - /diff.views/liquibase.properties --- README.md | 33 ++++++++++++++++++- .../changelog-dir/changelog-master.xml | 0 .../cleanup_all_views/01_cleanup-allviews.sql | 0 {prod => cleanup.views}/liquibase.properties | 0 dev/liquibase.properties | 7 ---- .../changelog-dir/changelog-master.xml | 0 diff.tables/liquibase.properties | 13 ++++++++ diff.views/changelog-dir/changelog-master.xml | 0 .../02_drop_liquibase_tables_ceanup.sql | 0 diff.views/liquibase.properties | 13 ++++++++ target/liquibase/migrate.sql | 25 -------------- 11 files changed, 58 insertions(+), 33 deletions(-) create mode 100644 cleanup.views/changelog-dir/changelog-master.xml create mode 100644 cleanup.views/changelog-dir/cleanup_all_views/01_cleanup-allviews.sql rename {prod => cleanup.views}/liquibase.properties (100%) delete mode 100644 dev/liquibase.properties create mode 100644 diff.tables/changelog-dir/changelog-master.xml create mode 100644 diff.tables/liquibase.properties create mode 100644 diff.views/changelog-dir/changelog-master.xml create mode 100644 diff.views/changelog-dir/drop_liquibase_tables/02_drop_liquibase_tables_ceanup.sql create mode 100644 diff.views/liquibase.properties delete mode 100644 target/liquibase/migrate.sql diff --git a/README.md b/README.md index 11d26de..b559c7f 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ mvn liquibase:update -Denv=cleanup.views ### 2. liquibase diff.tables script ```shell -mvn liquibase:diff -Denv=cleanup.tables -X > diff.tables/liquibase_log/liquibase_log_diff-$(date +%Y%m%d%H%M%S).log +mvn liquibase:diff -Denv=diff.tables -X > diff.tables/liquibase_log/liquibase_log_diff-$(date +%Y%m%d%H%M%S).log ``` ```shell @@ -66,5 +66,36 @@ 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 +``` +```shell +mvn liquibase:history > 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 +``` + +```shell +sed -i 's/JSONB DEFAULT \x7B\x7D/\jsonb DEFAULT \x27\x7B\x7D\x27/g' changelog-dir/diff-changelog/*.sql +sed -i 's/JSONB DEFAULT \[\]/\jsonb DEFAULT \x27\[\]\x27/g' changelog-dir/diff-changelog/*.sql +sed -i 's/\x220001-01-01T00:00:00+00:00\x22/\x27\[\x220001-01-01T00:00:00+00:00\x22\]\x27/g' changelog-dir/diff-changelog/*.sql +sed -i 's/JSONB DEFAULT \x7B\x7D/\jsonb DEFAULT \x27\x7B\x7D\x27\x3A\x3Ajsonb/g' changelog-dir/diff-changelog/*.sql +sed -i 's/JSONB DEFAULT \[\]/\jsonb DEFAULT \x27\[\]\x27\x3A\x3Ajsonb/g' changelog-dir/diff-changelog/*.sql +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/ +``` + +```shell +mvn liquibase:update -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 ``` \ No newline at end of file diff --git a/cleanup.views/changelog-dir/changelog-master.xml b/cleanup.views/changelog-dir/changelog-master.xml new file mode 100644 index 0000000..e69de29 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 new file mode 100644 index 0000000..e69de29 diff --git a/prod/liquibase.properties b/cleanup.views/liquibase.properties similarity index 100% rename from prod/liquibase.properties rename to cleanup.views/liquibase.properties diff --git a/dev/liquibase.properties b/dev/liquibase.properties deleted file mode 100644 index 030e632..0000000 --- a/dev/liquibase.properties +++ /dev/null @@ -1,7 +0,0 @@ -# username=dbuser01 -# password=QWEasd759 -# url=jdbc:postgresql://10.2.5.47:5432/db01 -# driver=org.postgresql.Driver -# classpath=/opt/liquibase/postgresql-42.6.0.jar -# changeLogFile=master.xml -# liquibaseSchemaName=liquibase \ No newline at end of file diff --git a/diff.tables/changelog-dir/changelog-master.xml b/diff.tables/changelog-dir/changelog-master.xml new file mode 100644 index 0000000..e69de29 diff --git a/diff.tables/liquibase.properties b/diff.tables/liquibase.properties new file mode 100644 index 0000000..2a91b78 --- /dev/null +++ b/diff.tables/liquibase.properties @@ -0,0 +1,13 @@ +# url=jdbc:postgresql://10.2.5.46:5432/db01 +# username=dbuser01 +# password=QWEasd759 + +# driver=org.postgresql.Driver +# classpath=/opt/liquibase/postgresql-42.6.0.jar +# changeLogFile=master.xml +# liquibaseSchemaName=liquibase +# defaultSchemaName=public + +# referenceUrl=jdbc:postgresql://10.2.5.47:5432/db01 +# referenceUsername=dbuser01 +# referencePassword=QWEasd759 \ No newline at end of file diff --git a/diff.views/changelog-dir/changelog-master.xml b/diff.views/changelog-dir/changelog-master.xml new file mode 100644 index 0000000..e69de29 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 new file mode 100644 index 0000000..e69de29 diff --git a/diff.views/liquibase.properties b/diff.views/liquibase.properties new file mode 100644 index 0000000..2a91b78 --- /dev/null +++ b/diff.views/liquibase.properties @@ -0,0 +1,13 @@ +# url=jdbc:postgresql://10.2.5.46:5432/db01 +# username=dbuser01 +# password=QWEasd759 + +# driver=org.postgresql.Driver +# classpath=/opt/liquibase/postgresql-42.6.0.jar +# changeLogFile=master.xml +# liquibaseSchemaName=liquibase +# defaultSchemaName=public + +# referenceUrl=jdbc:postgresql://10.2.5.47:5432/db01 +# referenceUsername=dbuser01 +# referencePassword=QWEasd759 \ No newline at end of file diff --git a/target/liquibase/migrate.sql b/target/liquibase/migrate.sql deleted file mode 100644 index 3dbfee8..0000000 --- a/target/liquibase/migrate.sql +++ /dev/null @@ -1,25 +0,0 @@ --- ********************************************************************* --- Update Database Script --- ********************************************************************* --- Change Log: prod/master.xml --- Ran at: 17.04.2024, 17:39 --- Against: dbuser01@jdbc:postgresql://10.2.5.46:5432/db01 --- Liquibase version: 4.17.0 --- ********************************************************************* - -SET SEARCH_PATH TO public, "$user","public"; - --- Lock Database -UPDATE databasechangeloglock SET LOCKED = TRUE, LOCKEDBY = 'centos7-netcore (10.2.5.28)', LOCKGRANTED = NOW() WHERE ID = 1 AND LOCKED = FALSE; - -SET SEARCH_PATH TO public, "$user","public"; - -SET SEARCH_PATH TO public, "$user","public"; - --- Release Database Lock -SET SEARCH_PATH TO public, "$user","public"; - -UPDATE databasechangeloglock SET LOCKED = FALSE, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1; - -SET SEARCH_PATH TO public, "$user","public"; -