liquibase-maven01/README.md
pashko 28d7981f4e 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
2024-06-17 21:39:46 +00:00

3.7 KiB

0. Структура проекта

.
├── 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

mvn liquibase:diff -Denv=cleanup.views -X > cleanup.views/liquibase_log/liquibase_log_diff-$(date +%Y%m%d%H%M%S).log 
mvn liquibase:update -Denv=cleanup.views

2. liquibase diff.tables script

mvn liquibase:diff -Denv=diff.tables -X >  diff.tables/liquibase_log/liquibase_log_diff-$(date +%Y%m%d%H%M%S).log 
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
mv  diff.tables/changelog-dir/diff-changelog/*.sql   diff.tables/changelog-dir/update-changelog/
mvn liquibase:update -X > diff.tables/liquibase_log/liquibase_log_update-$(date +%Y%m%d%H%M%S).log
mvn liquibase:history > diff.tables/liquibase_log/liquibase_log_history-$(date +%Y%m%d%H%M%S).log

3. liquibase diff.views script

mvn liquibase:diff -Denv=diff.views -X >  diff.tables/liquibase_log/liquibase_log_diff-$(date +%Y%m%d%H%M%S).log 
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
mv  diff.tables/changelog-dir/diff-changelog/*.sql   diff.tables/changelog-dir/update-changelog/
mvn liquibase:update -X > diff.tables/liquibase_log/liquibase_log_update-$(date +%Y%m%d%H%M%S).log
mvn liquibase:history > diff.tables/liquibase_log/liquibase_log_history-$(date +%Y%m%d%H%M%S).log