diff --git a/gradle.properties b/gradle.properties index 26dc9d2..37ae86b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -53,7 +53,7 @@ mod_name=Zontreck's Library Mod # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=GPLv3 # The mod version. See https://semver.org/ -mod_version=1201.13.042424.0010 +mod_version=1201.13.042424.0045 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/dev/zontreck/libzontreck/memory/world/DatabaseMigrations.java b/src/main/java/dev/zontreck/libzontreck/memory/world/DatabaseMigrations.java index 756ada2..82c8128 100644 --- a/src/main/java/dev/zontreck/libzontreck/memory/world/DatabaseMigrations.java +++ b/src/main/java/dev/zontreck/libzontreck/memory/world/DatabaseMigrations.java @@ -75,6 +75,8 @@ public class DatabaseMigrations PreparedStatement pstat = DatabaseWrapper.get().prepareStatement("REPLACE INTO `migrations` (tableID, version) VALUES (?,?);"); pstat.setString(0, tableID); pstat.setInt(1, version); + + pstat.execute(); } catch (SQLException ex) { ex.printStackTrace(); @@ -142,7 +144,7 @@ public class DatabaseMigrations if(lastTableChecked.tableID != m.tableID) lastTableChecked = getCurrentTable(m.tableID); } - if(m.version > lastTableChecked.version) { + if(lastTableChecked == null || m.version > lastTableChecked.version) { LibZontreck.LOGGER.info("Executing migration " + m.tableID + ":" + m.version); m.execute(); @@ -170,7 +172,7 @@ public class DatabaseMigrations return builder().withTableID(tableID).withVersion(result.getInt("version")); } - }catch (SQLException ex) + }catch (Exception ex) { if(tableID == "migrations") {