Minor fix & clean #32

Merged
flecomte merged 6 commits from minor_fix into master 2022-10-14 23:14:03 +02:00
2 changed files with 31 additions and 23 deletions
Showing only changes of commit 54a628c742 - Show all commits

View File

@@ -37,6 +37,7 @@ data class Function(
)
override fun up(): Status {
return try {
try {
connection.sendQuery(up.script)
} catch (e: CompletionException) {
@@ -55,10 +56,14 @@ data class Function(
doExecute = Action.OK
}
return Status.OK
Status.OK
} catch (e: Throwable) {
Status.UP_FAIL
}
}
override fun down(): Status {
return try {
connection.sendQuery(down.script)
this::class.java.classLoader
@@ -66,7 +71,10 @@ data class Function(
.readText()
.let { connection.sendQuery(it, listOf(down.name)) }
return Status.OK
Status.OK
} catch (e: Throwable) {
Status.DOWN_FAIL
}
}
override fun test(): Status {

View File

@@ -29,7 +29,7 @@ interface Migration {
fun down(): Status
fun test(): Status
enum class Status(i: Int) { OK(2), UP_FAIL(0), DOWN_FAIL(1) }
enum class Status(val i: Int) { OK(2), UP_FAIL(0), DOWN_FAIL(1) }
enum class Action { OK, UP, DOWN }
}