From ab6f9130f0da32261f14b442dcc89f09f411b25f Mon Sep 17 00:00:00 2001 From: zontreck Date: Wed, 24 Apr 2024 04:15:31 -0700 Subject: [PATCH] Fix the blocks table index --- gradle.properties | 2 +- .../libzontreck/memory/world/DatabaseMigrations.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index cc8e72a..d01acf0 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.0339 +mod_version=1201.13.042424.0415 # 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 8020df9..feb2415 100644 --- a/src/main/java/dev/zontreck/libzontreck/memory/world/DatabaseMigrations.java +++ b/src/main/java/dev/zontreck/libzontreck/memory/world/DatabaseMigrations.java @@ -133,6 +133,15 @@ public class DatabaseMigrations migrations.add(blocksUpdate); + 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`); "))); + + RegisterMigrationsEvent rme = new RegisterMigrationsEvent(); MinecraftForge.EVENT_BUS.post(rme);