mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-10-22 12:20:26 +02:00
Fix issue checking if the migration table exists or not
This commit is contained in:
parent
10f0d28673
commit
204677c3a9
@ -147,9 +147,15 @@ public class DataManager {
|
|||||||
int currentMigration = -1;
|
int currentMigration = -1;
|
||||||
boolean migrationsExist;
|
boolean migrationsExist;
|
||||||
|
|
||||||
DatabaseMetaData meta = connection.getMetaData();
|
// DatabaseMetaData meta = connection.getMetaData();
|
||||||
ResultSet res = meta.getTables(null, null, this.getMigrationsTableName(), new String[] {"TABLE"});
|
// ResultSet res = meta.getTables(null, null, this.getMigrationsTableName(), new String[] {"TABLE"});
|
||||||
migrationsExist = res.next();
|
// migrationsExist = res.next();
|
||||||
|
try {
|
||||||
|
connection.createStatement().execute("SELECT 1 FROM " + this.getMigrationsTableName());
|
||||||
|
migrationsExist = true;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
migrationsExist = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!migrationsExist) {
|
if (!migrationsExist) {
|
||||||
// No migration table exists, create one
|
// No migration table exists, create one
|
||||||
|
Loading…
Reference in New Issue
Block a user