From 7f67a6ae5407b349a67654c0de52b863fcfaf732 Mon Sep 17 00:00:00 2001 From: Xiao-MoMi <70987828+Xiao-MoMi@users.noreply.github.com> Date: Sun, 5 Mar 2023 00:55:39 +0800 Subject: [PATCH] Update SqlConstants.java --- .../customfishing/data/storage/SqlConstants.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/momirealms/customfishing/data/storage/SqlConstants.java b/src/main/java/net/momirealms/customfishing/data/storage/SqlConstants.java index eec25230..299a53bf 100644 --- a/src/main/java/net/momirealms/customfishing/data/storage/SqlConstants.java +++ b/src/main/java/net/momirealms/customfishing/data/storage/SqlConstants.java @@ -19,8 +19,8 @@ package net.momirealms.customfishing.data.storage; public class SqlConstants { - public static final String SQL_CREATE_BAG_TABLE = "CREATE TABLE IF NOT EXISTS `%s` ( `uuid` VARCHAR(36) NOT NULL, `version` INT(2) NOT NULL, `size` INT(8) NOT NULL, `contents` LONGTEXT NOT NULL, PRIMARY KEY (`uuid`) )"; - public static final String SQL_CREATE_SELL_TABLE = "CREATE TABLE IF NOT EXISTS `%s` ( `uuid` VARCHAR(36) NOT NULL, `version` INT(2) NOT NULL, `date` INT(4) NOT NULL, `money` INT(12) NOT NULL, PRIMARY KEY (`uuid`) )"; + public static final String SQL_CREATE_BAG_TABLE = "CREATE TABLE IF NOT EXISTS `%s` ( `uuid` VARCHAR(36) NOT NULL, `version` INT NOT NULL, `size` INT NOT NULL, `contents` LONGTEXT NOT NULL, PRIMARY KEY (`uuid`) )"; + public static final String SQL_CREATE_SELL_TABLE = "CREATE TABLE IF NOT EXISTS `%s` ( `uuid` VARCHAR(36) NOT NULL, `version` INT NOT NULL, `date` INT NOT NULL, `money` INT NOT NULL, PRIMARY KEY (`uuid`) )"; public static final String SQL_INSERT_BAG = "INSERT INTO `%s`(`uuid`, `version`, `size`, `contents`) VALUES (?, ?, ?, ?)"; public static final String SQL_INSERT_SELL = "INSERT INTO `%s`(`uuid`, `version`, `date`, `money`) VALUES (?, ?, ?, ?)"; public static final String SQL_UPDATE_BAG_BY_UUID = "UPDATE `%s` SET `version` = ?, `size` = ?, `contents` = ? WHERE `uuid` = ?"; @@ -28,6 +28,5 @@ public class SqlConstants { public static final String SQL_SELECT_BAG_BY_UUID = "SELECT * FROM `%s` WHERE `uuid` = ?"; public static final String SQL_SELECT_SELL_BY_UUID = "SELECT * FROM `%s` WHERE `uuid` = ?"; public static final String SQL_LOCK_BY_UUID = "UPDATE `%s` SET `version` = 1 WHERE `uuid` = ?"; - public static final String SQL_UNLOCK_BY_UUID = "UPDATE `%s` SET `version` = 0 WHERE `uuid` = ?"; - public static final String SQL_ALTER_TABLE = "ALTER TABLE `%s` ADD COLUMN `version` INT(2) NOT NULL AFTER `uuid`"; + public static final String SQL_ALTER_TABLE = "ALTER TABLE `%s` ADD COLUMN `version` INT NOT NULL DEFAULT `0` AFTER `uuid`"; }