diff --git a/gradle.properties b/gradle.properties index 9691c5f..cc8e72a 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.0307 +mod_version=1201.13.042424.0339 # 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 a850cb1..8020df9 100644 --- a/src/main/java/dev/zontreck/libzontreck/memory/world/DatabaseMigrations.java +++ b/src/main/java/dev/zontreck/libzontreck/memory/world/DatabaseMigrations.java @@ -123,6 +123,17 @@ public class DatabaseMigrations migrations.add(blocksTable.withMigrationAction(makeBlocksTable)); + Migration blocksUpdate = builder() + .withTableID("blocks") + .withVersion(2); + PreparedStatement removePKey = DatabaseWrapper.get().prepareStatement("ALTER TABLE `blocks` DROP PRIMARY KEY;"); + blocksUpdate.withMigrationAction(removePKey); + PreparedStatement addIDColumn = DatabaseWrapper.get().prepareStatement("ALTER TABLE `blocks` ADD `ID` INT NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`ID`);"); + blocksUpdate.withMigrationAction(addIDColumn); + + migrations.add(blocksUpdate); + + RegisterMigrationsEvent rme = new RegisterMigrationsEvent(); MinecraftForge.EVENT_BUS.post(rme);