59 lines
1.8 KiB
Markdown
59 lines
1.8 KiB
Markdown
|
|
```shell
|
|
.
|
|
├── changelog-dir
|
|
│ ├── changelog-master.xml
|
|
│ ├── diff-changelog
|
|
│ └── update-changelog
|
|
│ └── liquibase-diffChangeLog-20240503024308.sql
|
|
├── liquibase_log
|
|
│ ├── liquibase_log_diff-20240503104305.log
|
|
│ ├── liquibase_log_history-20240503104702.log
|
|
│ └── liquibase_log_update-20240503104616.log
|
|
├── liquibase.properties
|
|
├── pom.xml
|
|
└── README.md
|
|
|
|
```
|
|
|
|
#### 1. bla
|
|
```shell
|
|
mvn liquibase:diff -X > liquibase_log/liquibase_log_diff-$(date +%Y%m%d%H%M%S).log
|
|
```
|
|
|
|
#### 2. bla
|
|
|
|
* 2.1. asdasdasd
|
|
```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
|
|
```
|
|
* 2.2. asdasdasd
|
|
```shell
|
|
mv changelog-dir/diff-changelog/*.sql changelog-dir/update-changelog/
|
|
```
|
|
|
|
#### 3. asdasdsda
|
|
|
|
```shell
|
|
mvn liquibase:update -X > liquibase_log/liquibase_log_update-$(date +%Y%m%d%H%M%S).log
|
|
```
|
|
#### 4. asdasdsda
|
|
|
|
```shell
|
|
mvn liquibase:history > liquibase_log/liquibase_log_history-$(date +%Y%m%d%H%M%S).log
|
|
```
|
|
|
|
```sql
|
|
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 $$;
|
|
``` |