Compare commits

..

3 Commits

Author SHA1 Message Date
c4a135817a bump version to 1.1.0
All checks were successful
/ publish (push) Successful in 2m24s
2025-10-02 11:07:14 +02:00
3bf33999e4 add exceptions 2025-10-02 11:06:48 +02:00
69dc768052 suppress unused warnings 2025-10-02 11:02:20 +02:00
3 changed files with 13 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
group = "com.infendro"
version = "1.0.0"
version = "1.1.0"
repositories {
mavenCentral()

View File

@@ -1,5 +1,6 @@
package com.infendro.migration
import com.infendro.migration.exception.DuplicateMigrationException
import com.infendro.migration.model.MigrationRepository
import com.infendro.migration.model.MigrationTable
import org.jetbrains.exposed.sql.SchemaUtils
@@ -36,6 +37,7 @@ fun migrate(
}
}
@Suppress("UNUSED")
fun migrate(
configure: Config.() -> Unit
) {
@@ -47,10 +49,15 @@ fun migrate(
class Config {
internal val migrations: MutableList<Migration> = mutableListOf()
@Suppress("UNUSED")
fun migration(
name: String,
migrate: Transaction.() -> Unit,
) {
if (migrations.any { it.name == name }) {
throw DuplicateMigrationException(name)
}
migrations += Migration(name, migrate)
}

View File

@@ -0,0 +1,5 @@
package com.infendro.migration.exception
class DuplicateMigrationException(
val name: String,
) : Exception()