mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-25 03:42:24 +00:00
Show "Updating database finished" message
This commit is contained in:
parent
1b1e5de47e
commit
a2756620f5
@ -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()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user