Update 6 files

- /cleanup.views/changelog-dir/cleanup_all_views/01_cleanup-allviews.sql
- /cleanup.views/changelog-dir/changelog-master.xml
- /diff.tables/changelog-dir/changelog-master.xml
- /diff.views/changelog-dir/changelog-master.xml
- /pom.xml
- /README.md
This commit is contained in:
pashko 2024-06-17 23:07:48 +00:00
parent 28d7981f4e
commit c9237c6d50
6 changed files with 137 additions and 54 deletions

View File

@ -66,17 +66,17 @@ mv diff.tables/changelog-dir/diff-changelog/*.sql diff.tables/changelog-dir/u
``` ```
```shell ```shell
mvn liquibase:update -X > diff.tables/liquibase_log/liquibase_log_update-$(date +%Y%m%d%H%M%S).log mvn liquibase:update -Denv=diff.tables -X > diff.tables/liquibase_log/liquibase_log_update-$(date +%Y%m%d%H%M%S).log
``` ```
```shell ```shell
mvn liquibase:history > diff.tables/liquibase_log/liquibase_log_history-$(date +%Y%m%d%H%M%S).log 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 ### 3. liquibase diff.views script
```shell ```shell
mvn liquibase:diff -Denv=diff.views -X > diff.tables/liquibase_log/liquibase_log_diff-$(date +%Y%m%d%H%M%S).log mvn liquibase:diff -Denv=diff.views -X > diff.views/liquibase_log/liquibase_log_diff-$(date +%Y%m%d%H%M%S).log
``` ```
```shell ```shell
@ -89,13 +89,17 @@ sed -i 's/\x3F/\x3F\x3F/g' changelog-dir/diff-changelog/*.sql
``` ```
```shell ```shell
mv diff.tables/changelog-dir/diff-changelog/*.sql diff.tables/changelog-dir/update-changelog/ mv diff.views/changelog-dir/diff-changelog/*.sql diff.views/changelog-dir/update-changelog/
``` ```
```shell ```shell
mvn liquibase:update -X > diff.tables/liquibase_log/liquibase_log_update-$(date +%Y%m%d%H%M%S).log mvn liquibase:update -Denv=diff.views -X > diff.views/liquibase_log/liquibase_log_update-$(date +%Y%m%d%H%M%S).log
``` ```
```shell ```shell
mvn liquibase:history > diff.tables/liquibase_log/liquibase_log_history-$(date +%Y%m%d%H%M%S).log 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
```

View File

@ -0,0 +1,13 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.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">
<includeAll path="changelog-dir/update-changelog/"/>
</databaseChangeLog>

View File

@ -0,0 +1,7 @@
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 $$;

View File

@ -0,0 +1,13 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.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">
<includeAll path="changelog-dir/update-changelog/"/>
</databaseChangeLog>

View File

@ -0,0 +1,13 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.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">
<includeAll path="changelog-dir/update-changelog/"/>
</databaseChangeLog>

127
pom.xml
View File

@ -33,83 +33,116 @@
<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>${liquibase.version}</version>
<configuration> <configuration>
<changeLogFile>prod/master.xml</changeLogFile> <propertyFile>${profile.propertyFile}</propertyFile>
<driver>org.postgresql.Driver</driver> <changeLogFile>${profile.changeLogFile}</changeLogFile>
<username>dbuser01</username> <outputChangeLogFile>${profile.outputChangeLogFile}</outputChangeLogFile>
<password>QWEasd759</password> <diffChangeLogFile>${profile.diffChangeLogFile}</diffChangeLogFile>
<url>jdbc:postgresql://10.2.5.46:5432/db01</url>
<referenceDriver>org.postgresql.Driver</referenceDriver>
<referenceUrl>jdbc:postgresql://10.2.5.47:5432/db01</referenceUrl>
<referenceUsername>dbuser01</referenceUsername>
<referencePassword>QWEasd759</referencePassword>
<goal>diff</goal>
<dataDir>prod/data</dataDir> <dataDir>prod/data</dataDir>
<verbose>true</verbose> <driver>${profile.driver}</driver>
<!-- <logging>debug</logging> --> <url>${profile.url}</url>
<defaultSchemaName>${profile.defaultSchemaName}</defaultSchemaName>
<changelogSchemaName>${profile.changelogSchemaName}</changelogSchemaName>
<referenceDriver>${profile.drireferenceDriverver}</referenceDriver>
<referenceUrl>${profile.referenceUrl}</referenceUrl>
<referenceDefaultSchemaName>${profile.referenceDefaultSchemaName}</referenceDefaultSchemaName>
<goal>${goal}</goal>
<verbose>${profile.verbose}</verbose>
<logging>${profile.logging}</logging>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase> <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project>
<!-- <profiles> --> <profiles>
<!-- Development settings, -Denv=dev --> <!-- cleanup.views settings, -Denv=cleanup.views -->
<!-- <profile> <profile>
<id>dev</id> <id>cleanup.views</id>
<activation> <activation>
<property> <property>
<name>env</name> <name>env</name>
<value>dev</value> <value>cleanup.views</value>
</property> </property>
</activation> </activation>
<properties> <properties>
<profile.propertyFile>dev/liquibase.properties</profile.propertyFile> <profile.propertyFile>cleanup.views/liquibase.properties</profile.propertyFile>
<changeLogFile>dev/master.xml</changeLogFile> <changeLogFile>cleanup.views/changelog-dir/changelog-master.xml</changeLogFile>
<outputChangeLogFile>cleanup.views/changelog-dir/changelog-master.xml</outputChangeLogFile>
<diffChangeLogFile>cleanup.views/changelog-dir/diff.views.changelog/liquibase-diifChangeLog-${CI_JOB_NAME}_${CI_PIPLINE_ID}</diffChangeLogFile>
<dataDir>cleanup.views/data</dataDir>
<driver>org.postgresql.Driver</driver> <driver>org.postgresql.Driver</driver>
<username>dbuser01</username>
<password>QWEasd759</password>
<url>jdbc:postgresql://10.2.5.47:5432/db01</url> <url>jdbc:postgresql://10.2.5.47:5432/db01</url>
<defaultSchemaName>public</defaultSchemaName>
<changelogSchemaName>liquibase</changelogSchemaName>
<referenceDriver>org.postgresql.Driver</referenceDriver> <referenceDriver>org.postgresql.Driver</referenceDriver>
<referenceUrl>jdbc:postgresql://10.2.5.46:5432/db01</referenceUrl> <referenceUrl>jdbc:postgresql://10.2.5.46:5432/db01</referenceUrl>
<referenceUsername>dbuser01</referenceUsername> <referenceDefaultSchemaName>public</referenceDefaultSchemaName>
<referencePassword>QWEasd759</referencePassword>
<goal>diff</goal> <goal>diff</goal>
<dataDir>dev/data</dataDir>
<verbose>true</verbose> <verbose>true</verbose>
<logging>debug</logging> <logging>debug</logging>
</properties> </properties>
</profile> --> </profile>
<!-- Production settings, -Denv=prod -->
<!-- <profile>
<id>prod</id> <!-- diff.tables settings, -Denv=diff.tables -->
<profile>
<id>diff.tables</id>
<activation> <activation>
<property> <property>
<name>env</name> <name>env</name>
<value>prod</value> <value>diff.tables</value>
</property> </property>
</activation> </activation>
<activation>
<configuration>
<properties> <properties>
<profile.propertyFile>prod/liquibase.properties</profile.propertyFile> <profile.propertyFile>diff.tables/liquibase.properties</profile.propertyFile>
<changeLogFile>dprod/master.xml</changeLogFile> <changeLogFile>diff.tables/changelog-dir/changelog-master.xml</changeLogFile>
<outputChangeLogFile>diff.tables/changelog-dir/changelog-master.xml</outputChangeLogFile>
<diffChangeLogFile>diff.tables/changelog-dir/diff.changelog/liquibase-diifChangeLog-${CI_JOB_NAME}_${CI_PIPLINE_ID}</diffChangeLogFile>
<dataDir>diff.tables/data</dataDir>
<driver>org.postgresql.Driver</driver> <driver>org.postgresql.Driver</driver>
<username>dbuser01</username> <url>jdbc:postgresql://10.2.5.47:5432/db01</url>
<password>QWEasd759</password> <defaultSchemaName>public</defaultSchemaName>
<url>jdbc:postgresql://10.2.5.46:5432/db01</url> <changelogSchemaName>liquibase</changelogSchemaName>
<referenceDriver>org.postgresql.Driver</referenceDriver> <referenceDriver>org.postgresql.Driver</referenceDriver>
<referenceUrl>jdbc:postgresql://10.2.5.47:5432/db01</referenceUrl> <referenceUrl>jdbc:postgresql://10.2.5.46:5432/db01</referenceUrl>
<referenceUsername>dbuser01</referenceUsername> <referenceDefaultSchemaName>public</referenceDefaultSchemaName>
<referencePassword>QWEasd759</referencePassword>
<goal>diff</goal> <goal>diff</goal>
<dataDir>prod/data</dataDir>
<verbose>true</verbose> <verbose>true</verbose>
<logging>debug</logging> <logging>debug</logging>
</properties> </properties>
</configuration> </profile>
</activation>
</profile>-->
<!-- </profiles> -->
<!-- </project> -->
<!-- diff.views settings, -Denv=diff.views -->
<profile>
<id>diff.views</id>
<activation>
<property>
<name>env</name>
<value>diff.views</value>
</property>
</activation>
<properties>
<profile.propertyFile>diff.views/liquibase.properties</profile.propertyFile>
<changeLogFile>diff.views/changelog-dir/changelog-master.xml</changeLogFile>
<outputChangeLogFile>diff.views/changelog-dir/changelog-master.xml</outputChangeLogFile>
<diffChangeLogFile>diff.views/changelog-dir/diff.changelog/liquibase-diifChangeLog-${CI_JOB_NAME}_${CI_PIPLINE_ID}</diffChangeLogFile>
<dataDir>diff.viewss/data</dataDir>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://10.2.5.47:5432/db01</url>
<defaultSchemaName>public</defaultSchemaName>
<changelogSchemaName>liquibase</changelogSchemaName>
<referenceDriver>org.postgresql.Driver</referenceDriver>
<referenceUrl>jdbc:postgresql://10.2.5.46:5432/db01</referenceUrl>
<referenceDefaultSchemaName>public</referenceDefaultSchemaName>
<goal>diff</goal>
<verbose>true</verbose>
<logging>debug</logging>
</properties>
</profile>
</profiles>
</project>