Skip to content

Commit

Permalink
Merge pull request #134 from KenjiOhtsuka/develop
Browse files Browse the repository at this point in the history
make jarmonicaDown Available
  • Loading branch information
KenjiOhtsuka committed Aug 4, 2019
2 parents 9fadf19 + 9df7791 commit 2d8a552
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ task javadocJar(type: Jar) {
}

group 'com.improve_future'
version '1.1.23'
version '1.1.24'

apply plugin: "com.gradle.plugin-publish"
apply plugin: 'kotlin'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal abstract class DbAdapter(private val connection: ConnectionInterface) {
abstract fun createTable(tableName: String, tableBuilder: TableBuilder)

fun dropTable(tableName: String) {
execute("DROP TABLE $tableName;")
execute("DROP TABLE $tableName")
}

abstract fun createIndex(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package com.improve_future.harmonica.service

import com.improve_future.harmonica.core.AbstractMigration
import com.improve_future.harmonica.core.Connection
import com.improve_future.harmonica.core.Dbms
import java.nio.file.Paths
import java.sql.ResultSet
import java.sql.Statement
Expand Down Expand Up @@ -86,13 +87,24 @@ class VersionService(private val migrationTableName: String) {

val statement = connection.createStatement()
try {
val resultSet = statement.executeQuery(
"""
SELECT version
FROM $migrationTableName
ORDER BY version DESC
LIMIT 1""".trimIndent()
)
val resultSet: ResultSet
when (connection.config.dbms) {
Dbms.Oracle -> {
resultSet = statement.executeQuery("""
SELECT version
FROM $migrationTableName
ORDER BY version DESC
FETCH FIRST 1 ROWS ONLY""".trimIndent())
}
else -> {
resultSet = statement.executeQuery("""
SELECT version
FROM $migrationTableName
ORDER BY version DESC
LIMIT 1""".trimIndent())
}
}

if (resultSet.next()) result = resultSet.getString(1)
resultSet.close()
statement.close()
Expand Down

0 comments on commit 2d8a552

Please sign in to comment.