Go back and revise the database migrations. Breaking change

This commit is contained in:
zontreck 2024-04-30 15:31:53 -07:00
parent 0d735ec2e8
commit aa9f0c5235
2 changed files with 4 additions and 9 deletions

View file

@ -66,7 +66,8 @@ public class DatabaseMigrations
try {
DatabaseWrapper.get().executePreparedStatement(pstmt);
} catch (SQLException e) {
LibZontreck.LOGGER.warn("There was a problem executing a migration. The migration is " + pstmt+"\n\nThis does not necessarily mean a failure. If everything seems to work fine, this migration might not have been necessary.");
LibZontreck.LOGGER.warn("There was a problem executing a migration. The migration is " + pstmt+"\n\nThis does not necessarily mean a failure. If everything seems to work fine, this migration might not have been necessary.\n\n");
e.printStackTrace();
}
}
@ -115,10 +116,7 @@ public class DatabaseMigrations
" `posZ` int(11) NOT NULL," +
" `snapshotID` int(11) NOT NULL DEFAULT 0 COMMENT 'Enables multiple blocks existing at the same position'," +
" `block` blob NOT NULL COMMENT 'NBT Data representing a SavedBlock'," +
" PRIMARY KEY (`time`)," +
" UNIQUE KEY `posX` (`posX`)," +
" UNIQUE KEY `posY` (`posY`)," +
" UNIQUE KEY `posZ` (`posZ`)" +
" PRIMARY KEY (`time`)" +
") ;");
migrations.add(blocksTable.withMigrationAction(makeBlocksTable));
@ -136,9 +134,6 @@ public class DatabaseMigrations
migrations.add(builder()
.withTableID("blocks")
.withVersion(3)
.withMigrationAction(DatabaseWrapper.get().prepareStatement(" ALTER TABLE `blocks` DROP INDEX `posX`; "))
.withMigrationAction(DatabaseWrapper.get().prepareStatement(" ALTER TABLE `blocks` DROP INDEX `posY`; "))
.withMigrationAction(DatabaseWrapper.get().prepareStatement(" ALTER TABLE `blocks` DROP INDEX `posZ`; "))
.withMigrationAction(DatabaseWrapper.get().prepareStatement("ALTER TABLE `savedBlocks`.`blocks` ADD UNIQUE (`posX`, `posY`, `posZ`); ")));