Skip to content

Commit 2fc49da

Browse files
committed
Install Flyway
1 parent 2a286fd commit 2fc49da

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

pom.xml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<properties>
1919
<java.version>17</java.version>
2020

21-
<!-- 3.6.3 is the last version of maven 3 that has been released. Back in 2019 😬 -->
21+
<!-- 3.6.3 is the last version of maven 3 that has been released. Back in 2019 -->
2222
<maven-enforcer.plugin.mvn-min-version>3.6.3</maven-enforcer.plugin.mvn-min-version>
2323

2424
<!-- Dependency versions -->
@@ -27,6 +27,7 @@
2727
<versions.maven.build-helper>3.6.0</versions.maven.build-helper>
2828
<versions.maven.enforcer>3.5.0</versions.maven.enforcer>
2929
<versions.maven.ktlint>3.5.0</versions.maven.ktlint>
30+
<versions.maven.flyway>10.10.0</versions.maven.flyway>
3031

3132
<!-- Library versions -->
3233
<versions.retrofit>2.11.0</versions.retrofit>
@@ -35,6 +36,7 @@
3536
<versions.springdoc>2.6.0</versions.springdoc>
3637
<versions.wiremock>3.12.1</versions.wiremock>
3738
<versions.mockito>5.17.0</versions.mockito>
39+
<versions.postgresql>42.7.7</versions.postgresql>
3840

3941
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
4042

@@ -247,6 +249,29 @@
247249
</execution>
248250
</executions>
249251
</plugin>
252+
<plugin>
253+
<groupId>org.flywaydb</groupId>
254+
<artifactId>flyway-maven-plugin</artifactId>
255+
<version>${versions.maven.flyway}</version>
256+
<dependencies>
257+
<dependency>
258+
<groupId>org.postgresql</groupId>
259+
<artifactId>postgresql</artifactId>
260+
<version>${versions.postgresql}</version>
261+
</dependency>
262+
</dependencies>
263+
<configuration>
264+
<url>jdbc:postgresql://localhost:6432/authdb</url>
265+
<user>dbauth</user>
266+
<password>authpassword</password>
267+
<schemas>
268+
<schema>public</schema>
269+
</schemas>
270+
<locations>
271+
<location>filesystem:src/main/resources/db/migration</location>
272+
</locations>
273+
</configuration>
274+
</plugin>
250275

251276
<!-- plugins for testing -->
252277
<plugin>
@@ -290,6 +315,11 @@
290315
<!-- version inherited from the Spring Boot parent POM -->
291316
<version>${kotlin.version}</version>
292317
</dependency>
318+
<dependency>
319+
<groupId>org.jetbrains.kotlin</groupId>
320+
<artifactId>kotlin-reflect</artifactId>
321+
<version>${kotlin.version}</version>
322+
</dependency>
293323
<dependency>
294324
<groupId>com.squareup.retrofit2</groupId>
295325
<artifactId>retrofit</artifactId>
@@ -334,6 +364,14 @@
334364
<groupId>org.postgresql</groupId>
335365
<artifactId>postgresql</artifactId>
336366
</dependency>
367+
<dependency>
368+
<groupId>org.flywaydb</groupId>
369+
<artifactId>flyway-core</artifactId>
370+
</dependency>
371+
<dependency>
372+
<groupId>org.flywaydb</groupId>
373+
<artifactId>flyway-database-postgresql</artifactId>
374+
</dependency>
337375

338376
<!-- dependencies for testing -->
339377
<dependency>

src/main/resources/application.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,11 @@ db.name=@db.name@
5757
db.username=@db.username@
5858
db.password=@db.password@
5959
db.session-schema=@db.session.schema@
60+
61+
############################################
62+
# Flyway migration settings
63+
############################################
64+
spring.flyway.enabled=true
65+
spring.flyway.baseline-on-migrate=true
66+
spring.flyway.schemas=@db.session.schema@
67+
spring.flyway.locations=classpath:db/migration

0 commit comments

Comments
 (0)