Compare commits
17
Commits
387629caee
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88f3011e06 | ||
|
|
c810fd3c1b | ||
|
|
d21c96dca1 | ||
|
|
25c9a23b6c | ||
|
|
3a4dcdc1ca | ||
|
|
d48d2721c6 | ||
|
|
fb890fb324 | ||
|
|
eed3857728 | ||
|
|
a6ab535c47 | ||
|
|
d0239ce2f7 | ||
|
|
af3d3e83bd | ||
|
|
8e86a8c181 | ||
|
|
20b71a2234 | ||
|
|
abf63179c6 | ||
|
|
1e7545e050 | ||
|
|
53b3cb3648 | ||
|
|
aba194e067 |
@@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
diff-changelog
|
diff-changelog
|
||||||
|
liquibase_log
|
||||||
|
*.log
|
||||||
*.csv
|
*.csv
|
||||||
|
*.sql
|
||||||
@@ -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 $$;
|
||||||
|
```
|
||||||
@@ -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
|
||||||
@@ -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/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">
|
http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
|
||||||
|
|
||||||
|
<includeAll path="changelog-dir/update-changelog/"/>
|
||||||
|
|
||||||
<includeAll path="changelog-dir/diff-changelog/"/>
|
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
username:dbuser01
|
||||||
|
password:QWEasd759
|
||||||
|
defaultSchemaName: public
|
||||||
|
liquibaseSchemaName: liquibase
|
||||||
|
|
||||||
|
|
||||||
|
referenceUsername: dbuser01
|
||||||
|
referencePassword: QWEasd759
|
||||||
|
referenceDefaultSchemaName:public
|
||||||
|
referenceLiquibaseSchemaName: liquibase
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<liquibase.version>4.17.0</liquibase.version>
|
<liquibase.version>4.27.0</liquibase.version>
|
||||||
<postgresql.version>42.6.0</postgresql.version>
|
<postgresql.version>42.7.3</postgresql.version>
|
||||||
<snakeyaml.version>1.32</snakeyaml.version>
|
<snakeyaml.version>1.32</snakeyaml.version>
|
||||||
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
|
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
|
||||||
</properties>
|
</properties>
|
||||||
@@ -34,22 +34,18 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.liquibase</groupId>
|
<groupId>org.liquibase</groupId>
|
||||||
<artifactId>liquibase-maven-plugin</artifactId>
|
<artifactId>liquibase-maven-plugin</artifactId>
|
||||||
<version>4.17.0</version>
|
<version>4.27.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<changeLogDirectory>changelog-dir/diff-changelog/</changeLogDirectory>
|
<propertyFile>liquibase.properties</propertyFile>
|
||||||
<changeLogFile>changelog-dir/changelog-master.xml</changeLogFile>
|
<changeLogFile>changelog-dir/changelog-master.xml</changeLogFile>
|
||||||
<outputChangeLogFile>changelog-dir/changelog-master.xml</outputChangeLogFile>
|
<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>
|
<changelogSchemaName>liquibase</changelogSchemaName>
|
||||||
<defaultSchemaName>public</defaultSchemaName>
|
<defaultSchemaName>public</defaultSchemaName>
|
||||||
<driver>org.postgresql.Driver</driver>
|
<driver>org.postgresql.Driver</driver>
|
||||||
<username>dbuser01</username>
|
|
||||||
<password>QWEasd759</password>
|
|
||||||
<url>jdbc:postgresql://10.2.5.46:5432/db02-pom</url>
|
<url>jdbc:postgresql://10.2.5.46:5432/db02-pom</url>
|
||||||
<referenceDriver>org.postgresql.Driver</referenceDriver>
|
<referenceDriver>org.postgresql.Driver</referenceDriver>
|
||||||
<referenceUrl>jdbc:postgresql://10.2.5.47:5432/db01-pom</referenceUrl>
|
<referenceUrl>jdbc:postgresql://10.2.5.47:5432/db01-pom</referenceUrl>
|
||||||
<referenceUsername>dbuser01</referenceUsername>
|
|
||||||
<referencePassword>QWEasd759</referencePassword>
|
|
||||||
<goal>diff</goal>
|
<goal>diff</goal>
|
||||||
<dataDir>/data</dataDir>
|
<dataDir>/data</dataDir>
|
||||||
<verbose>true</verbose>
|
<verbose>true</verbose>
|
||||||
|
|||||||
Reference in New Issue
Block a user