Minor fix & clean #32
@@ -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 {
|
||||
|
||||
@@ -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 }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user