From aa9f0c52356d8cd1a728324a2c2ddd1fccea78f8 Mon Sep 17 00:00:00 2001 From: zontreck Date: Tue, 30 Apr 2024 15:31:53 -0700 Subject: [PATCH] Go back and revise the database migrations. Breaking change --- gradle.properties | 2 +- .../libzontreck/memory/world/DatabaseMigrations.java | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index 490c2bb..7540185 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.043024.1524 +mod_version=1201.13.043024.1530 # 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 5ff1277..7b34300 100644 --- a/src/main/java/dev/zontreck/libzontreck/memory/world/DatabaseMigrations.java +++ b/src/main/java/dev/zontreck/libzontreck/memory/world/DatabaseMigrations.java @@ -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`); ")));