### 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=diff.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 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 -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.views/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.views/changelog-dir/diff-changelog/*.sql diff.views/changelog-dir/update-changelog/ ``` ```shell 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 -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 ```