Skip to content

Commit 0cbf300

Browse files
Feature/liquibase 6 (#371)
* Liquibase config * Configure liquibase maven plugin, rename ignoreOutdatedSchema -> skipSchemaUpdate * Remove docker integration * wip * Add latest db scripts * Fix test, opt out of liquibase * fix formatting * PR fixes * Remove old db scripts
1 parent 50d2a06 commit 0cbf300

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+587
-1273
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ___
1515
- [Docker image](#docker-image)
1616
- [Web Application Archive](#web-application-archive)
1717
- [User Interface](#user-interface)
18+
- [Development](#development)
1819
- [How to contribute](#how-to-contribute)
1920
<!-- tocstop -->
2021

@@ -134,6 +135,7 @@ db.password=
134135
db.keepAliveConnection=true
135136
db.connectionPool=HikariCP
136137
db.numThreads=4
138+
db.skip.liquibase=false
137139
```
138140

139141
## Embedded Tomcat
@@ -202,6 +204,15 @@ Hyperdrive-trigger can be packaged as a Web Application Archive and executed in
202204
- Without tests: `mvn clean package -DskipTests`
203205
- With unit tests: `mvn clean package`
204206

207+
## Liquibase
208+
The liquibase maven plugin may be used to issue liquibase commands. To use it, copy
209+
`/etc/liquibase/liquibase-maven-plugin.properties.template` to `/etc/liquibase/liquibase-maven-plugin.properties` and modify it as needed.
210+
211+
Then, the liquibase maven plugin can be executed, e.g.
212+
- `mvn liquibase:status` to view the status
213+
- `mvn liquibase:dropAll` to drop all tables, views etc.
214+
- `mvn liquibase:update` to apply all pending changesets
215+
205216
# User Interface
206217
- **Workflows**: Overview of all workflows.
207218
![](/docs/img/all_workflows.png)

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ services:
1818
postgres_container:
1919
image: postgres:11
2020
volumes:
21-
- ./target/classes/db_scripts/db_script_v8.sql:/docker-entrypoint-initdb.d/db.sql
2221
- postgres-data:/var/lib/postgresql/data
2322
environment:
2423
- POSTGRES_PASSWORD=password

etc/liquibase/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
liquibase-maven-plugin.properties
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Copyright 2018 ABSA Group Limited
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
# Copy this file to liquibase-maven-plugin.properties with your local settings
17+
# Then, execute mvn:liquibase status to test connection the setup
18+
19+
driver=org.postgresql.Driver
20+
url=jdbc:postgresql://localhost:5432/hyperdriver
21+
username=hyperdriver
22+
password=
23+
changeLogFile=src/main/resources/db_scripts/liquibase/db.changelog.yml

pom.xml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
~ limitations under the License.
1515
-->
1616

17-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
17+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1819

1920
<modelVersion>4.0.0</modelVersion>
2021
<version>0.3.3-SNAPSHOT</version>
@@ -116,15 +117,16 @@
116117
<commons.lang3.version>3.11</commons.lang3.version>
117118
<javamelody.spring.boot.starter.version>1.86.0</javamelody.spring.boot.starter.version>
118119
<buildnumber.maven.plugin.version>1.4</buildnumber.maven.plugin.version>
119-
120+
<liquibase-maven-plugin.version>3.10.2</liquibase-maven-plugin.version>
121+
<snakeyaml.version>1.25</snakeyaml.version>
120122

121123
<!-- Deployment -->
122124
<gpg.plugin.version>1.6</gpg.plugin.version>
123125
<nexus.staging.plugin.version>1.6.8</nexus.staging.plugin.version>
124126
<maven.release.plugin.version>2.5.3</maven.release.plugin.version>
125127

126128
<skipNpmTests>${skipTests}</skipNpmTests>
127-
<scalatest.suites />
129+
<scalatest.suites/>
128130
<scalatest.tagsToExclude>za.co.absa.hyperdrive.trigger.testdata.PersistingData</scalatest.tagsToExclude>
129131
</properties>
130132

@@ -215,6 +217,20 @@
215217
<artifactId>cron-utils</artifactId>
216218
<version>${cronutils.version}</version>
217219
</dependency>
220+
<dependency>
221+
<groupId>org.liquibase</groupId>
222+
<artifactId>liquibase-maven-plugin</artifactId>
223+
<version>${liquibase-maven-plugin.version}</version>
224+
</dependency>
225+
<!-- For Liquibase yaml -->
226+
<dependency>
227+
<groupId>org.yaml</groupId>
228+
<artifactId>snakeyaml</artifactId>
229+
<version>${snakeyaml.version}</version>
230+
</dependency>
231+
232+
233+
<!-- WebJars -->
218234
<dependency>
219235
<groupId>org.apache.commons</groupId>
220236
<artifactId>commons-lang3</artifactId>
@@ -348,6 +364,22 @@
348364
</archive>
349365
</configuration>
350366
</plugin>
367+
<plugin>
368+
<groupId>org.liquibase</groupId>
369+
<artifactId>liquibase-maven-plugin</artifactId>
370+
<version>${liquibase-maven-plugin.version}</version>
371+
<configuration>
372+
<propertyFile>etc/liquibase/liquibase-maven-plugin.properties</propertyFile>
373+
</configuration>
374+
<dependencies>
375+
<dependency>
376+
<groupId>org.postgresql</groupId>
377+
<artifactId>postgresql</artifactId>
378+
<version>${postgresql}</version>
379+
</dependency>
380+
</dependencies>
381+
</plugin>
382+
351383
<!-- Deployment-->
352384
<plugin>
353385
<groupId>org.apache.maven.plugins</groupId>
@@ -499,7 +531,7 @@
499531
<id>testdata</id>
500532
<properties>
501533
<scalatest.suites>za.co.absa.hyperdrive.trigger.testdata.TestDataGeneratorLocal</scalatest.suites>
502-
<scalatest.tagsToExclude />
534+
<scalatest.tagsToExclude/>
503535
<skip.npm>true</skip.npm>
504536
<skip.installnodenpm>true</skip.installnodenpm>
505537
</properties>

src/main/resources/application.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,6 @@ db.password=
9494
db.keepAliveConnection=true
9595
db.connectionPool=HikariCP
9696
db.numThreads=4
97+
98+
db.skip.liquibase=false
99+
spring.liquibase.change-log=classpath:/db_scripts/liquibase/db.changelog.yml

src/main/resources/db_scripts/db_script_v1.sql

Lines changed: 0 additions & 138 deletions
This file was deleted.

0 commit comments

Comments
 (0)