From 6b85c914a5acdd9bb9bd9a952b65c162c2ded31f Mon Sep 17 00:00:00 2001 From: Chris Miles Date: Sat, 21 May 2022 22:44:04 -0500 Subject: [PATCH] Schema consistency fixes (#2192) --- common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + utils/sql/git/required/2022_04_30_hp_regen_per_second.sql | 2 +- utils/sql/git/required/2022_05_02_npc_types_int64.sql | 8 ++++---- utils/sql/git/required/2022_05_21_schema_consistency.sql | 5 +++++ 5 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 utils/sql/git/required/2022_05_21_schema_consistency.sql diff --git a/common/version.h b/common/version.h index b9f3d43b3..7f186361a 100644 --- a/common/version.h +++ b/common/version.h @@ -34,7 +34,7 @@ * Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9183 +#define CURRENT_BINARY_DATABASE_VERSION 9184 #ifdef BOTS #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9028 diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 8b17eba27..0b4410c81 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -437,6 +437,7 @@ 9181|2022_05_03_task_activity_goal_match_list.sql|SHOW COLUMNS FROM `task_activities` LIKE 'goal_match_list'|empty| 9182|2022_05_02_npc_types_int64.sql|SHOW COLUMNS FROM `npc_types` LIKE 'hp'|missing|bigint 9183|2022_05_07_merchant_data_buckets.sql|SHOW COLUMNS FROM `merchantlist` LIKE 'bucket_comparison'|empty +9184|2022_05_21_schema_consistency.sql|SELECT * FROM db_version WHERE version >= 9184|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2022_04_30_hp_regen_per_second.sql b/utils/sql/git/required/2022_04_30_hp_regen_per_second.sql index cc2d85a47..6f61ae838 100644 --- a/utils/sql/git/required/2022_04_30_hp_regen_per_second.sql +++ b/utils/sql/git/required/2022_04_30_hp_regen_per_second.sql @@ -1 +1 @@ -ALTER TABLE npc_types ADD COLUMN hp_regen_per_second bigint(11) DEFAULT 0 AFTER hp_regen_rate; \ No newline at end of file +ALTER TABLE npc_types ADD COLUMN hp_regen_per_second bigint DEFAULT 0 AFTER hp_regen_rate; diff --git a/utils/sql/git/required/2022_05_02_npc_types_int64.sql b/utils/sql/git/required/2022_05_02_npc_types_int64.sql index 5a018b919..fb52824ee 100644 --- a/utils/sql/git/required/2022_05_02_npc_types_int64.sql +++ b/utils/sql/git/required/2022_05_02_npc_types_int64.sql @@ -1,4 +1,4 @@ -ALTER TABLE npc_types MODIFY COLUMN hp BIGINT; -ALTER TABLE npc_types MODIFY COLUMN mana BIGINT; -ALTER TABLE npc_types MODIFY COLUMN hp_regen_rate BIGINT; -ALTER TABLE npc_types MODIFY COLUMN mana_regen_rate BIGINT; +ALTER TABLE npc_types MODIFY COLUMN hp BIGINT NOT NULL DEFAULT 0; +ALTER TABLE npc_types MODIFY COLUMN mana BIGINT NOT NULL DEFAULT 0; +ALTER TABLE npc_types MODIFY COLUMN hp_regen_rate BIGINT NOT NULL DEFAULT 0; +ALTER TABLE npc_types MODIFY COLUMN mana_regen_rate BIGINT NOT NULL DEFAULT 0; diff --git a/utils/sql/git/required/2022_05_21_schema_consistency.sql b/utils/sql/git/required/2022_05_21_schema_consistency.sql new file mode 100644 index 000000000..5f8004f15 --- /dev/null +++ b/utils/sql/git/required/2022_05_21_schema_consistency.sql @@ -0,0 +1,5 @@ +ALTER TABLE npc_types MODIFY COLUMN hp BIGINT NOT NULL DEFAULT 0; +ALTER TABLE npc_types MODIFY COLUMN mana BIGINT NOT NULL DEFAULT 0; +ALTER TABLE npc_types MODIFY COLUMN hp_regen_rate BIGINT NOT NULL DEFAULT 0; +ALTER TABLE npc_types MODIFY COLUMN mana_regen_rate BIGINT NOT NULL DEFAULT 0; +ALTER TABLE npc_types MODIFY COLUMN hp_regen_per_second BIGINT NOT NULL DEFAULT 0;