This commit is contained in:
@@ -3,10 +3,20 @@ package com.infendro.ktor.migration
|
||||
import com.infendro.migration.Config
|
||||
import com.infendro.migration.migrate
|
||||
import io.ktor.server.application.*
|
||||
import org.jetbrains.exposed.sql.Transaction
|
||||
|
||||
val Migration = createApplicationPlugin(
|
||||
name = "Migration",
|
||||
createConfiguration = { Config() },
|
||||
createConfiguration = { MigrationConfig() },
|
||||
) {
|
||||
migrate(pluginConfig)
|
||||
migrate(pluginConfig.config)
|
||||
}
|
||||
|
||||
class MigrationConfig {
|
||||
internal val config = Config()
|
||||
|
||||
fun migration(
|
||||
name: String,
|
||||
migrate: Transaction.() -> Unit,
|
||||
) = config.migration(name, migrate)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user