Compare commits

..
17 Commits
Author SHA1 Message Date
pashko 88f3011e06 Update README02 2024-06-04 14:16:18 +08:00
pashko c810fd3c1b Update README02 2024-05-30 17:40:23 +08:00
pashko d21c96dca1 Add README02 2024-05-30 17:37:23 +08:00
pashko 25c9a23b6c change README.md 2024-05-15 19:38:31 +08:00
pashko 3a4dcdc1ca change README.md 2024-05-15 16:11:48 +08:00
pashko d48d2721c6 change README.md 2024-05-08 14:38:29 +08:00
pashko fb890fb324 change README.md 2024-05-08 14:20:38 +08:00
pashko eed3857728 change README.md 2024-05-03 19:33:00 +08:00
pashko a6ab535c47 change README.md 2024-05-03 19:17:56 +08:00
pashko d0239ce2f7 change README.md, delete include dir diff-changelog from changelog-dir/changelog-master.xml 2024-05-03 10:58:52 +08:00
pashko af3d3e83bd change README.md, delete changelog-dir/my_function.sql 2024-05-03 09:24:57 +08:00
pashko 8e86a8c181 change README.md 2024-05-02 22:45:02 +08:00
pashko 20b71a2234 change README.md 2024-05-02 20:39:49 +08:00
pashko abf63179c6 add README.md 2024-05-02 20:34:52 +08:00
pashko 1e7545e050 add README.md 2024-05-02 20:22:53 +08:00
pashko 53b3cb3648 final01 pom.xml 2024-05-02 19:51:57 +08:00
pashko aba194e067 final pom.xml 2024-05-02 19:50:29 +08:00
7 changed files with 140 additions and 13 deletions
+25
View File
@@ -0,0 +1,25 @@
GROUPID=ru.corp.tn.ecm-liquibase
ARTIFACTID=liquibase
VERSION=1.0.0
DESCRIPTION=Ecm liquibase migration
LIQUIBASE.VERSION=4.17.0
POSTGRESQL.VERSION=42.6.0
SNAKEYAML.VERSION=1.32
CHANGELOGDIRECTORY=changelog-dir/diff-changelog/
CHANGELOGFILE=changelog-dir/changelog-master.xml
OUTPUTCHANGELOGFILE=changelog-dir/changelog-master.xml
DIFFCHANGELOGFILE=changelog-dir/diff-changelog/liquibase-diffChangeLog-${maven.build.timestamp}.xml
CHANGELOGSCHEMANAME=liquibase
DRIVER=org.postgresql.Driver
USERNAME=dbuser01
PASSWORD=QWEasd759
URL=jdbc:postgresql://10.2.5.46:5432/db02-pom #destination DB
REFERENCEDRIVER=org.postgresql.Driver
REFERENCEURL=jdbc:postgresql://10.2.5.47:5432/db01-pom #source DB
REFERENCEUSERNAME=dbuser01
REFERENCEPASSWORD=QWEasd759
DATADIR=changelog-dir/diff-changelog/data
+3
View File
@@ -1,2 +1,5 @@
diff-changelog
liquibase_log
*.log
*.csv
*.sql
+59
View File
@@ -0,0 +1,59 @@
```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 $$;
```
+34
View File
@@ -0,0 +1,34 @@
.
├── 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 -4
View File
@@ -9,8 +9,5 @@
http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd
http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<includeAll path="changelog-dir/diff-changelog/"/>
<includeAll path="changelog-dir/update-changelog/"/>
</databaseChangeLog>
+13
View File
@@ -0,0 +1,13 @@
username:dbuser01
password:QWEasd759
defaultSchemaName: public
liquibaseSchemaName: liquibase
referenceUsername: dbuser01
referencePassword: QWEasd759
referenceDefaultSchemaName:public
referenceLiquibaseSchemaName: liquibase
+5 -9
View File
@@ -11,8 +11,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<liquibase.version>4.17.0</liquibase.version>
<postgresql.version>42.6.0</postgresql.version>
<liquibase.version>4.27.0</liquibase.version>
<postgresql.version>42.7.3</postgresql.version>
<snakeyaml.version>1.32</snakeyaml.version>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
</properties>
@@ -34,22 +34,18 @@
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>4.17.0</version>
<version>4.27.0</version>
<configuration>
<changeLogDirectory>changelog-dir/diff-changelog/</changeLogDirectory>
<propertyFile>liquibase.properties</propertyFile>
<changeLogFile>changelog-dir/changelog-master.xml</changeLogFile>
<outputChangeLogFile>changelog-dir/changelog-master.xml</outputChangeLogFile>
<diffChangeLogFile>changelog-dir/diff-changelog/liquibase-diffChangeLog-${maven.build.timestamp}.xml</diffChangeLogFile>
<diffChangeLogFile>changelog-dir/diff-changelog/liquibase-diffChangeLog-${maven.build.timestamp}.sql</diffChangeLogFile>
<changelogSchemaName>liquibase</changelogSchemaName>
<defaultSchemaName>public</defaultSchemaName>
<driver>org.postgresql.Driver</driver>
<username>dbuser01</username>
<password>QWEasd759</password>
<url>jdbc:postgresql://10.2.5.46:5432/db02-pom</url>
<referenceDriver>org.postgresql.Driver</referenceDriver>
<referenceUrl>jdbc:postgresql://10.2.5.47:5432/db01-pom</referenceUrl>
<referenceUsername>dbuser01</referenceUsername>
<referencePassword>QWEasd759</referencePassword>
<goal>diff</goal>
<dataDir>/data</dataDir>
<verbose>true</verbose>