Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make jarmonicaDown Available #134

Merged
merged 4 commits into from
Aug 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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