Skip to content

Commit 5eb9a9c

Browse files
Merge pull request ehrbase#1450 from ehrbase/feature/CDR-1667-gracefully-exit-on-future-db-version-V2
CDR-1667 Update flyway to V11 to gracefully exit on future db version
2 parents 6592940 + 9b2f8b3 commit 5eb9a9c

File tree

6 files changed

+17
-15
lines changed

6 files changed

+17
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1515
### Changed
1616
* Added check for duplicate version IDs during Folder creation as well as check for Folder uid and if-match header id during update ([#1410](https://github.com/ehrbase/ehrbase/pull/1410))
1717
* Remove EHR from AQL if not needed for the query ([#1448](https://github.com/ehrbase/ehrbase/pull/1448))
18+
* Update flyway to V11 to Gracefully exit in case installed flyway DB is newer than supported ([#1450](https://github.com/ehrbase/ehrbase/pull/1450))
1819
### Fixed
19-
* Allow Template overwrite with renamed property from `system.allow-template-overwrite` to `ehrbase.template..allow-overwrite` ([#1440](https://github.com/ehrbase/ehrbase/pull/1440))
20+
* Allow Template overwrite with renamed property from `system.allow-template-overwrite` to `ehrbase.template.allow-overwrite` ([#1440](https://github.com/ehrbase/ehrbase/pull/1440))
2021

2122
## [2.11.0]
2223
### Added

bom/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<commons-io.version>2.18.0</commons-io.version>
6060
<commons-lang3.version>3.17.0</commons-lang3.version>
6161
<ehrbase.openehr.sdk.version>2.20.0</ehrbase.openehr.sdk.version>
62-
<flyway.version>8.5.13</flyway.version>
62+
<flyway.version>11.1.1</flyway.version>
6363
<jackson-bom.version>2.18.1</jackson-bom.version>
6464
<javamelody.version>1.99.1</javamelody.version>
6565
<jooq.version>3.19.15</jooq.version>
@@ -305,6 +305,11 @@
305305
<artifactId>flyway-core</artifactId>
306306
<version>${flyway.version}</version>
307307
</dependency>
308+
<dependency>
309+
<groupId>org.flywaydb</groupId>
310+
<artifactId>flyway-database-postgresql</artifactId>
311+
<version>${flyway.version}</version>
312+
</dependency>
308313
<dependency>
309314
<groupId>javax.annotation</groupId>
310315
<artifactId>javax.annotation-api</artifactId>

configuration/pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,6 @@
9393
<groupId>io.micrometer</groupId>
9494
<artifactId>micrometer-registry-prometheus</artifactId>
9595
</dependency>
96-
<dependency>
97-
<groupId>org.flywaydb</groupId>
98-
<artifactId>flyway-core</artifactId>
99-
</dependency>
100-
<!--
101-
<dependency>
102-
<groupId>org.flywaydb</groupId>
103-
<artifactId>flyway-database-postgresql</artifactId>
104-
</dependency>
105-
-->
10696
<dependency>
10797
<groupId>org.ehrbase.openehr</groupId>
10898
<artifactId>service</artifactId>

configuration/src/main/java/org/ehrbase/configuration/config/flyway/MigrationStrategyConfig.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.Map;
2121
import org.flywaydb.core.Flyway;
2222
import org.flywaydb.core.api.configuration.FluentConfiguration;
23+
import org.flywaydb.core.api.pattern.ValidatePattern;
2324
import org.slf4j.Logger;
2425
import org.slf4j.LoggerFactory;
2526
import org.springframework.beans.factory.annotation.Value;
@@ -83,6 +84,10 @@ public FlywayMigrationStrategy flywayMigrationStrategy(
8384
private FluentConfiguration setSchema(Flyway flyway, String schema) {
8485
return Flyway.configure()
8586
.dataSource(flyway.getConfiguration().getDataSource())
87+
.validateOnMigrate(true)
88+
// does not ignore *:Future migrations
89+
// see https://documentation.red-gate.com/fd/ignore-migration-patterns-224919720.html
90+
.ignoreMigrationPatterns(ValidatePattern.fromPattern("*:Ignored"))
8691
.schemas(schema);
8792
}
8893
}

configuration/src/main/resources/application.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ logging:
149149
org.jooq.Constants: warn
150150
org.springframework: info
151151
org.springframework.security.web.DefaultSecurityFilterChain: warn
152-
org.flywaydb.core.internal.license.VersionPrinter: warn
153152
pattern:
154153
console: '%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr([%X]){faint} %clr(${PID}){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx'
155154

jooq-pg/pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
<groupId>org.flywaydb</groupId>
5555
<artifactId>flyway-core</artifactId>
5656
</dependency>
57+
<dependency>
58+
<groupId>org.flywaydb</groupId>
59+
<artifactId>flyway-database-postgresql</artifactId>
60+
</dependency>
5761
</dependencies>
5862

5963
<build>
@@ -122,13 +126,11 @@
122126
<artifactId>postgresql</artifactId>
123127
<version>${postgresql.version}</version>
124128
</dependency>
125-
<!--
126129
<dependency>
127130
<groupId>org.flywaydb</groupId>
128131
<artifactId>flyway-database-postgresql</artifactId>
129132
<version>${flyway.version}</version>
130133
</dependency>
131-
-->
132134
</dependencies>
133135
<executions>
134136
<execution>

0 commit comments

Comments
 (0)