Add SQL migrations

This commit is contained in:
2020-04-12 00:08:20 +02:00
parent b87a5c3744
commit 8a6d93c51a
4 changed files with 36 additions and 1 deletions
+20
View File
@@ -0,0 +1,20 @@
package be.vandewalleh.migrations
import be.vandewalleh.features.Feature
import org.flywaydb.core.Flyway
import org.kodein.di.Kodein
import org.kodein.di.generic.instance
import javax.sql.DataSource
class Migration(override val kodein: Kodein) : Feature(kodein) {
override fun execute() {
val dataSource by instance<DataSource>()
val flyway = Flyway.configure()
.dataSource(dataSource)
.baselineOnMigrate(true)
.load()
flyway.migrate()
}
}