From dc562e705fa82b29d9ed3ef89a8e4276ac0953f0 Mon Sep 17 00:00:00 2001 From: pashko Date: Mon, 17 Jun 2024 14:09:59 +0000 Subject: [PATCH] Update file README.md --- README.md | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..11d26de --- /dev/null +++ b/README.md @@ -0,0 +1,70 @@ +### 0. Структура проекта +```shell +. +├── cleanup.views +│ ├── changelog-dir +│ │ ├── changelog-master.xml +│ │ ├── cleanup_all_views +│ │ │ └── 01_cleanup-allviews.sql +│ │ └── diff.views.changelog +│ ├── liquibase_log +│ └── liquibase.properties +├── diff.tables +│ ├── changelog-dir +│ │ ├── changelog-master.xml +│ │ ├── diff-changelog +│ │ ├── function_before_create_tables +│ │ ├── functions +│ │ ├── functions_after_create_tables +│ │ └── update-changelog +│ ├── liquibase_log +│ └── liquibase.properties +├── diff.views +│ ├── changelog-dir +│ │ ├── changelog-master.xml +│ │ ├── diff-changelog +│ │ ├── drop_liquibase_tables +│ │ │ └── 02_drop_liquibase_tables_ceanup.sql +│ │ ├── function_before_create_views +│ │ ├── functions +│ │ ├── functions_after_create_views +│ │ └── update-changelog +│ ├── liquibase_log +│ └── liquibase.properties +├── package +├── pom.xml +└── REAMDME.md +``` + +### 1. clean-up all views before liquibase diff.Views script + +```shell +mvn liquibase:diff -Denv=cleanup.views -X > cleanup.views/liquibase_log/liquibase_log_diff-$(date +%Y%m%d%H%M%S).log +``` + +```shell +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 +``` + +```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 + +``` \ No newline at end of file