add exceptions
This commit is contained in:
@@ -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
|
||||
@@ -53,6 +54,10 @@ class Config {
|
||||
name: String,
|
||||
migrate: Transaction.() -> Unit,
|
||||
) {
|
||||
if (migrations.any { it.name == name }) {
|
||||
throw DuplicateMigrationException(name)
|
||||
}
|
||||
|
||||
migrations += Migration(name, migrate)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.infendro.migration.exception
|
||||
|
||||
class DuplicateMigrationException(
|
||||
val name: String,
|
||||
) : Exception()
|
||||
Reference in New Issue
Block a user