feature #9: add lock on execute migration

This commit is contained in:
2019-07-05 21:09:07 +02:00
parent 9c02fd21ca
commit 6dc5e611aa
4 changed files with 48 additions and 9 deletions

View File

@@ -16,9 +16,9 @@ class MigrationTest(): TestAbstract() {
fun upQuery() {
val resources = File(this::class.java.getResource("/sql/migrations").toURI())
val m = Migrations(resources, getConnextion())
m.up().let {
it `should contain` Pair("1", Migration.Status.OK)
it.size `should be equal to` 1
m.up().apply {
this `should contain` Pair("1", Migration.Status.OK)
size `should be equal to` 1
}
m.up().size `should be equal to` 0
@@ -37,9 +37,9 @@ class MigrationTest(): TestAbstract() {
val resources = File(this::class.java.getResource("/sql/migrations").toURI())
val m = Migrations(resources, getConnextion())
repeat(3) {
m.down(true).let {
it `should contain` Pair("1", Migration.Status.OK)
it.size `should be equal to` 1
m.down(true).apply {
this `should contain` Pair("1", Migration.Status.OK)
size `should be equal to` 1
}
}
}
@@ -54,4 +54,14 @@ class MigrationTest(): TestAbstract() {
test().size `should be equal to` 2
}
}
@Test
fun `test run migrations`() {
val resources = File(this::class.java.getResource("/sql/real_migrations").toURI())
Migrations(resources, getConnextion()).apply {
run().apply {
size `should be equal to` 2
}
}
}
}