This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
group = "com.infendro"
|
||||
version = "1.0.1"
|
||||
version = "1.0.2"
|
||||
|
||||
repositories {
|
||||
maven("https://git.infendro.com/api/packages/Infendro/maven")
|
||||
@@ -13,6 +13,7 @@ plugins {
|
||||
|
||||
dependencies {
|
||||
implementation(libs.ktor.server)
|
||||
implementation(libs.exposed)
|
||||
implementation(libs.migration)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[versions]
|
||||
kotlin = "2.2.10"
|
||||
ktor = "3.2.3"
|
||||
exposed = "0.61.0"
|
||||
migration = "1.0.0"
|
||||
|
||||
[plugins]
|
||||
@@ -9,4 +10,5 @@ kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||
[libraries]
|
||||
ktor-server = { module = "io.ktor:ktor-server-core-jvm", version.ref = "ktor" }
|
||||
|
||||
exposed = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposed" }
|
||||
migration = { module = "com.infendro:migration", version.ref = "migration" }
|
||||
|
||||
@@ -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