Clean
This commit is contained in:
parent
2a583ed399
commit
1c8c7ba8d7
@ -31,7 +31,7 @@ fun Application.module() {
|
||||
import(configurationModule)
|
||||
import(serviceModule)
|
||||
|
||||
bind<Feature>() with singleton { Migration(this.kodein) }
|
||||
bind<Migration>() with singleton { Migration(this.kodein) }
|
||||
bind<Database>() with singleton { Database.Companion.connect(this.instance<DataSource>()) }
|
||||
}
|
||||
|
||||
@ -39,9 +39,8 @@ fun Application.module() {
|
||||
|
||||
log.debug(kodein.container.tree.bindings.description())
|
||||
|
||||
// TODO, clean this (migration)
|
||||
val feature by kodein.instance<Feature>()
|
||||
feature.execute()
|
||||
val migration by kodein.instance<Migration>()
|
||||
migration.migrate()
|
||||
|
||||
val controllers by kodein.instance<Set<KodeinController>>()
|
||||
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
package be.vandewalleh.migrations
|
||||
|
||||
import be.vandewalleh.features.Feature
|
||||
import org.flywaydb.core.Flyway
|
||||
import org.kodein.di.Kodein
|
||||
import org.kodein.di.KodeinAware
|
||||
import org.kodein.di.generic.instance
|
||||
import javax.sql.DataSource
|
||||
|
||||
class Migration(override val kodein: Kodein) : Feature(kodein) {
|
||||
class Migration(override val kodein: Kodein) : KodeinAware {
|
||||
|
||||
override fun execute() {
|
||||
fun migrate() {
|
||||
val dataSource by instance<DataSource>()
|
||||
val flyway = Flyway.configure()
|
||||
.dataSource(dataSource)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user