Show "Updating database finished" message

This commit is contained in:
Eric 2019-06-16 16:45:45 +02:00
parent 1b1e5de47e
commit a2756620f5

View File

@ -64,7 +64,7 @@ public abstract class Database {
abstract String getQueryGetTable(); abstract String getQueryGetTable();
private void update() throws SQLException { private boolean update() throws SQLException {
String queryGetTable = getQueryGetTable(); String queryGetTable = getQueryGetTable();
String queryUpdateVersion = "REPLACE INTO " + tableFields + " VALUES ('version', ?)"; String queryUpdateVersion = "REPLACE INTO " + tableFields + " VALUES ('version', ?)";
@ -197,6 +197,8 @@ public abstract class Database {
ps.setInt(1, DATABASE_VERSION); ps.setInt(1, DATABASE_VERSION);
ps.executeUpdate(); ps.executeUpdate();
} }
return needsUpdate1 || needsUpdate2;
} }
} }
@ -235,7 +237,9 @@ public abstract class Database {
try (Connection con = dataSource.getConnection()) { try (Connection con = dataSource.getConnection()) {
// Update database structure if necessary // Update database structure if necessary
update(); if (update()) {
plugin.getLogger().info("Updating database finished");
}
// Create shop table // Create shop table
try (Statement s = con.createStatement()) { try (Statement s = con.createStatement()) {