Add a new migration to the blocks table
This commit is contained in:
parent
0e4d9a832a
commit
43a1a44a8f
2 changed files with 12 additions and 1 deletions
|
@ -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);
|
||||
|
||||
|
|
Reference in a new issue