Skip to content

Commit c764812

Browse files
committed
Fix migration if multiple statements are provided
Beforehand only the first statement was executed.
1 parent 79c92cc commit c764812

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/src/main/java/com/github/games647/fastlogin/core/storage/MigrationManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ protected void migrateTable(MigratableStorage table) {
120120
core.getPlugin().getLog().info("Starting database migration of table {} to version {}",
121121
table.getTableName(), i + 1);
122122
try (Connection con = storage.getDataSource().getConnection();
123-
Statement migrateStmt = con.createStatement();
124-
PreparedStatement saveStmt = con.prepareStatement(INSERT_MIGRATION);
125-
) {
123+
PreparedStatement saveStmt = con.prepareStatement(INSERT_MIGRATION)) {
126124
for (String statement : getMigrationStatement(table, i)) {
127-
migrateStmt.executeUpdate(statement);
125+
try (Statement migrateStmt = con.createStatement()) {
126+
migrateStmt.executeUpdate(statement);
127+
}
128128
}
129129

130130
// add entry to migrations table

0 commit comments

Comments
 (0)