Migrations were not being properly updated
This commit is contained in:
parent
e7f289d709
commit
4fefc79f5f
2 changed files with 5 additions and 3 deletions
|
@ -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.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=GPLv3
|
mod_license=GPLv3
|
||||||
# The mod version. See https://semver.org/
|
# 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.
|
# 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.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
|
|
@ -75,6 +75,8 @@ public class DatabaseMigrations
|
||||||
PreparedStatement pstat = DatabaseWrapper.get().prepareStatement("REPLACE INTO `migrations` (tableID, version) VALUES (?,?);");
|
PreparedStatement pstat = DatabaseWrapper.get().prepareStatement("REPLACE INTO `migrations` (tableID, version) VALUES (?,?);");
|
||||||
pstat.setString(0, tableID);
|
pstat.setString(0, tableID);
|
||||||
pstat.setInt(1, version);
|
pstat.setInt(1, version);
|
||||||
|
|
||||||
|
pstat.execute();
|
||||||
} catch (SQLException ex)
|
} catch (SQLException ex)
|
||||||
{
|
{
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
@ -142,7 +144,7 @@ public class DatabaseMigrations
|
||||||
if(lastTableChecked.tableID != m.tableID) lastTableChecked = getCurrentTable(m.tableID);
|
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);
|
LibZontreck.LOGGER.info("Executing migration " + m.tableID + ":" + m.version);
|
||||||
m.execute();
|
m.execute();
|
||||||
|
@ -170,7 +172,7 @@ public class DatabaseMigrations
|
||||||
return builder().withTableID(tableID).withVersion(result.getInt("version"));
|
return builder().withTableID(tableID).withVersion(result.getInt("version"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (SQLException ex)
|
}catch (Exception ex)
|
||||||
{
|
{
|
||||||
if(tableID == "migrations")
|
if(tableID == "migrations")
|
||||||
{
|
{
|
||||||
|
|
Reference in a new issue