Upgrade dependencies
This commit is contained in:
@@ -19,7 +19,7 @@ jobs:
|
|||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
key: gradle-${{ hashFiles('**/libs.versions.toml') }}
|
key: gradle-${{ hashFiles('**/libs.versions.toml') }}
|
||||||
restore-keys: gradle-
|
restore-keys: gradle
|
||||||
path: |
|
path: |
|
||||||
~/.gradle/caches/
|
~/.gradle/caches/
|
||||||
~/.gradle/wrapper/
|
~/.gradle/wrapper/
|
||||||
@@ -12,17 +12,13 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("com.infendro:ktor-migration:1.1.1")
|
implementation("com.infendro:ktor-migration:1.2.0")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
import com.infendro.ktor.migration.Migration
|
|
||||||
import io.ktor.server.application.*
|
|
||||||
import org.jetbrains.exposed.sql.Database
|
|
||||||
|
|
||||||
fun Application.configureDatabase() {
|
fun Application.configureDatabase() {
|
||||||
// connect to a database
|
// connect to a database
|
||||||
Database.connect(/* parameters */)
|
Database.connect(/* parameters */)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import com.infendro.plugin.infendro
|
|||||||
import com.infendro.plugin.token
|
import com.infendro.plugin.token
|
||||||
|
|
||||||
group = "com.infendro"
|
group = "com.infendro"
|
||||||
version = "1.1.1"
|
version = "1.2.0"
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.infendro)
|
alias(libs.plugins.infendro)
|
||||||
@@ -16,9 +16,10 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(libs.migration)
|
|
||||||
implementation(libs.ktor.server)
|
implementation(libs.ktor.server)
|
||||||
|
implementation(libs.migration)
|
||||||
implementation(libs.exposed)
|
implementation(libs.exposed)
|
||||||
|
implementation(libs.exposed.jdbc)
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
[versions]
|
[versions]
|
||||||
infendro = "1.0.0"
|
infendro = "1.1.0"
|
||||||
kotlin = "2.2.21"
|
kotlin = "2.3.0"
|
||||||
ktor = "3.3.3"
|
ktor = "3.4.0"
|
||||||
exposed = "0.61.0"
|
migration = "1.2.0"
|
||||||
migration = "1.1.1"
|
exposed = "1.0.0"
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
infendro = { id = "com.infendro.plugin", version.ref = "infendro" }
|
infendro = { id = "com.infendro.plugin", version.ref = "infendro" }
|
||||||
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
migration = { module = "com.infendro:migration", version.ref = "migration" }
|
|
||||||
ktor-server = { module = "io.ktor:ktor-server-core-jvm", version.ref = "ktor" }
|
ktor-server = { module = "io.ktor:ktor-server-core-jvm", version.ref = "ktor" }
|
||||||
|
migration = { module = "com.infendro:migration", version.ref = "migration" }
|
||||||
exposed = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposed" }
|
exposed = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposed" }
|
||||||
|
exposed-jdbc = { module = "org.jetbrains.exposed:exposed-jdbc", version.ref = "exposed" }
|
||||||
|
|||||||
@@ -2,20 +2,18 @@ package com.infendro.ktor.migration
|
|||||||
|
|
||||||
import com.infendro.migration.migrate
|
import com.infendro.migration.migrate
|
||||||
import io.ktor.server.application.*
|
import io.ktor.server.application.*
|
||||||
import org.jetbrains.exposed.sql.Transaction
|
import org.jetbrains.exposed.v1.jdbc.JdbcTransaction
|
||||||
|
|
||||||
val Migration = createApplicationPlugin(
|
val Migration = createApplicationPlugin("Migration", MigrationConfig::new) {
|
||||||
name = "Migration",
|
|
||||||
createConfiguration = { MigrationConfig() },
|
|
||||||
) {
|
|
||||||
migrate(pluginConfig.config)
|
migrate(pluginConfig.config)
|
||||||
}
|
}
|
||||||
|
|
||||||
class MigrationConfig {
|
class MigrationConfig {
|
||||||
internal val config = com.infendro.migration.MigrationConfig()
|
internal val config = com.infendro.migration.MigrationConfig()
|
||||||
|
|
||||||
fun migration(
|
fun migration(name: String, migrate: JdbcTransaction.() -> Unit) = config.migration(name, migrate)
|
||||||
name: String,
|
|
||||||
migrate: Transaction.() -> Unit,
|
companion object {
|
||||||
) = config.migration(name, migrate)
|
fun new() = MigrationConfig()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user