Skip to content

Commit

Permalink
Merge pull request #32 from FigureTechnologies/flyway-default-removal
Browse files Browse the repository at this point in the history
Flyway default removal
  • Loading branch information
celloman authored Nov 2, 2022
2 parents 952994c + ab1b559 commit 94885f3
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ data class DatabaseProperties(
val port: String,
val schema: String,
@Pattern(value = "\\d{1,2}") val connectionPoolSize: String,
val baselineOnMigrate: Boolean,
val repairFlywayChecksums: Boolean,
val baselineOnMigrate: Boolean = false,
val repairFlywayChecksums: Boolean = false,
)
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@ class DataConfig {
if (databaseProperties.type != "postgresql") {
baseline()
}
if (databaseProperties.repairFlywayChecksums) {
logger.warn("Flyway checksum repair has been requested! This should only be enabled temporarily. Set db.repairFlywayChecks=false or omit the value ASAP")
repair()
}
}

@Bean
fun flywayInitializer(flyway: Flyway): FlywayMigrationInitializer = FlywayMigrationInitializer(flyway)

@Bean("MigrationsExecuted")
fun flywayMigration(dataSource: DataSource, databaseProperties: DatabaseProperties, flyway: Flyway): Int {
if (databaseProperties.repairFlywayChecksums) {
logger.warn("Flyway checksum repair has been requested! This should only be enabled temporarily. Set db.repairFlywayChecks=false or omit the value ASAP")
flyway.repair()
}
flyway.info().all().forEach { logger.info("Flyway migration: ${it.script}") }
return flyway.migrate().migrationsExecuted
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class MemoryMigrationsTest {
schema = "object-store-gateway",
connectionPoolSize = "1",
baselineOnMigrate = false,
repairFlywayChecksums = false,
)
DbMigrationTester(properties).removeDatabaseTables().testMigrations()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,5 @@ class PostgresqlMigrationsTest {
schema = "object-store-gateway",
connectionPoolSize = "1",
baselineOnMigrate = false,
repairFlywayChecksums = false,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class SqliteMigrationsTest {
schema = "object-store-gateway",
connectionPoolSize = "1",
baselineOnMigrate = false,
repairFlywayChecksums = false,
)
DbMigrationTester(properties).testMigrations()
}
Expand Down
1 change: 0 additions & 1 deletion server/src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ db.port=""
db.schema=object-store-gateway
db.connectionPoolSize=1
db.baselineOnMigrate=true
db.repairFlywayChecksums=false

0 comments on commit 94885f3

Please sign in to comment.