From f2dca290bc77920c538271165d476a14db77e1cc Mon Sep 17 00:00:00 2001 From: Jack Fisher Date: Wed, 31 Jul 2024 22:33:03 +0100 Subject: [PATCH] Update NPC Bots db_characters SQL Updated the db_characters SQL files relating to NPC Bots. - Updated charset to utf8mb4. - Added collate utf8mb_unicode_ci. - Added comments. - Replaced /custom SQL files with top level SQL files. --- .../base/db_characters/characters_npcbot.sql | 7 ++++--- .../characters_npcbot_gear_storage.sql | 14 +++++++++++++ .../characters_npcbot_group_member.sql | 2 +- .../db_characters/characters_npcbot_logs.sql} | 5 ++++- .../db_characters/characters_npcbot_stats.sql | 2 +- .../characters_npcbot_transmog.sql | 8 ++++---- .../creature_template_npcbot_appearance.sql | 2 +- .../creature_template_npcbot_extras.sql | 2 +- ...l => creature_template_npcbot_outfits.sql} | 12 +++++------ ...5_16_00_characters_npcbot_gear_storage.sql | 11 ---------- ...23_05_26_00_characters_npcbot_transmog.sql | 2 -- .../2024_03_12_00_characters_npcbot.sql | 20 ------------------- 12 files changed, 36 insertions(+), 51 deletions(-) create mode 100644 data/sql/base/db_characters/characters_npcbot_gear_storage.sql rename data/sql/{custom/db_characters/2024_05_29_00_characters_npcbot_logs.sql => base/db_characters/characters_npcbot_logs.sql} (81%) rename data/sql/base/db_world/{creature_template_outfits.sql => creature_template_npcbot_outfits.sql} (75%) delete mode 100644 data/sql/custom/db_characters/2023_05_16_00_characters_npcbot_gear_storage.sql delete mode 100644 data/sql/custom/db_characters/2023_05_26_00_characters_npcbot_transmog.sql delete mode 100644 data/sql/custom/db_characters/2024_03_12_00_characters_npcbot.sql diff --git a/data/sql/base/db_characters/characters_npcbot.sql b/data/sql/base/db_characters/characters_npcbot.sql index bf7b5077539717..020a05df1d0664 100644 --- a/data/sql/base/db_characters/characters_npcbot.sql +++ b/data/sql/base/db_characters/characters_npcbot.sql @@ -6,10 +6,11 @@ SET FOREIGN_KEY_CHECKS=0; DROP TABLE IF EXISTS `characters_npcbot`; CREATE TABLE `characters_npcbot` ( `entry` int(10) unsigned NOT NULL COMMENT 'creature_template.entry', - `owner` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'characters.guid (lowguid)', - `roles` int(10) unsigned NOT NULL COMMENT 'bitmask: tank(1),dps(2),heal(4),ranged(8)', + `owner` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'characters.guid', + `roles` int(10) unsigned NOT NULL COMMENT 'Bitmask: Tank(1), DPS(2), Healer(4), Ranged(8)', `spec` tinyint(3) unsigned NOT NULL DEFAULT '1', `faction` int(10) unsigned NOT NULL DEFAULT '35', + `hire_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `equipMhEx` int(10) unsigned NOT NULL DEFAULT '0', `equipOhEx` int(10) unsigned NOT NULL DEFAULT '0', `equipRhEx` int(10) unsigned NOT NULL DEFAULT '0', @@ -30,4 +31,4 @@ CREATE TABLE `characters_npcbot` ( `equipNeck` int(10) unsigned NOT NULL DEFAULT '0', `spells_disabled` longtext, PRIMARY KEY (`entry`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='NPC Bot Character System'; diff --git a/data/sql/base/db_characters/characters_npcbot_gear_storage.sql b/data/sql/base/db_characters/characters_npcbot_gear_storage.sql new file mode 100644 index 00000000000000..445d94fed3b488 --- /dev/null +++ b/data/sql/base/db_characters/characters_npcbot_gear_storage.sql @@ -0,0 +1,14 @@ +-- +SET FOREIGN_KEY_CHECKS=0; +-- ---------------------------- +-- Table structure for characters_npcbot_gear_storage +-- ---------------------------- +DROP TABLE IF EXISTS `characters_npcbot_gear_storage`; +CREATE TABLE `characters_npcbot_gear_storage` ( + `guid` int(10) unsigned NOT NULL DEFAULT '0', + `item_guid` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`item_guid`), + KEY `existing_player` (`guid`), + CONSTRAINT `FK_npcbot_gear_storage_item_guid` FOREIGN KEY (`item_guid`) REFERENCES `item_instance` (`guid`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `FK_npcbot_gear_storage_guid` FOREIGN KEY (`guid`) REFERENCES `characters` (`guid`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='NPC Bot Gear Storage System'; diff --git a/data/sql/base/db_characters/characters_npcbot_group_member.sql b/data/sql/base/db_characters/characters_npcbot_group_member.sql index 82e3fd801cc8fd..3544d8f1260a8a 100644 --- a/data/sql/base/db_characters/characters_npcbot_group_member.sql +++ b/data/sql/base/db_characters/characters_npcbot_group_member.sql @@ -11,4 +11,4 @@ CREATE TABLE `characters_npcbot_group_member` ( `subgroup` tinyint(3) unsigned NOT NULL DEFAULT '0', `roles` tinyint(3) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`entry`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='NPC Bot Group System'; \ No newline at end of file diff --git a/data/sql/custom/db_characters/2024_05_29_00_characters_npcbot_logs.sql b/data/sql/base/db_characters/characters_npcbot_logs.sql similarity index 81% rename from data/sql/custom/db_characters/2024_05_29_00_characters_npcbot_logs.sql rename to data/sql/base/db_characters/characters_npcbot_logs.sql index 61b872eee98d8e..50a83ae1d36cf8 100644 --- a/data/sql/custom/db_characters/2024_05_29_00_characters_npcbot_logs.sql +++ b/data/sql/base/db_characters/characters_npcbot_logs.sql @@ -1,5 +1,8 @@ -- SET FOREIGN_KEY_CHECKS=0; +-- ---------------------------- +-- Table structure for characters_npcbot_logs +-- ---------------------------- DROP TABLE IF EXISTS `characters_npcbot_logs`; CREATE TABLE `characters_npcbot_logs` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT, @@ -16,4 +19,4 @@ CREATE TABLE `characters_npcbot_logs` ( `param5` varchar(51) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='NPC Bot Logs System'; diff --git a/data/sql/base/db_characters/characters_npcbot_stats.sql b/data/sql/base/db_characters/characters_npcbot_stats.sql index 1870cf36b05812..0b788dfd0acce1 100644 --- a/data/sql/base/db_characters/characters_npcbot_stats.sql +++ b/data/sql/base/db_characters/characters_npcbot_stats.sql @@ -33,4 +33,4 @@ CREATE TABLE `characters_npcbot_stats` ( `expertise` int(10) unsigned NOT NULL DEFAULT '0', `armorPenPct` float unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`entry`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='NPC Bot Stats System'; diff --git a/data/sql/base/db_characters/characters_npcbot_transmog.sql b/data/sql/base/db_characters/characters_npcbot_transmog.sql index 36674af6982434..72146ac302d8ac 100644 --- a/data/sql/base/db_characters/characters_npcbot_transmog.sql +++ b/data/sql/base/db_characters/characters_npcbot_transmog.sql @@ -8,7 +8,7 @@ CREATE TABLE `characters_npcbot_transmog` ( `entry` int(10) unsigned NOT NULL, `slot` tinyint(3) unsigned NOT NULL, `item_id` int(10) unsigned NOT NULL DEFAULT '0', - `fake_id` int(10) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`entry`,`slot`), - CONSTRAINT `bot_id` FOREIGN KEY (`entry`) REFERENCES `characters_npcbot` (`entry`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; + `fake_id` int(10) unsigned NOT NULL DEFAULT '-1', + PRIMARY KEY (`entry`, `slot`), + CONSTRAINT `FK_npcbot_transmog_entry` FOREIGN KEY (`entry`) REFERENCES `characters_npcbot` (`entry`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='NPC Bot Transmog System'; diff --git a/data/sql/base/db_world/creature_template_npcbot_appearance.sql b/data/sql/base/db_world/creature_template_npcbot_appearance.sql index c042e1e9694e8b..15693ca202eed3 100644 --- a/data/sql/base/db_world/creature_template_npcbot_appearance.sql +++ b/data/sql/base/db_world/creature_template_npcbot_appearance.sql @@ -14,7 +14,7 @@ CREATE TABLE `creature_template_npcbot_appearance` ( `haircolor` tinyint(3) unsigned NOT NULL DEFAULT '0', `features` tinyint(3) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`entry`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='NPC Bot Appearance System'; -- ---------------------------- -- Records diff --git a/data/sql/base/db_world/creature_template_npcbot_extras.sql b/data/sql/base/db_world/creature_template_npcbot_extras.sql index 2b2f083a31877f..33044b5bb29447 100644 --- a/data/sql/base/db_world/creature_template_npcbot_extras.sql +++ b/data/sql/base/db_world/creature_template_npcbot_extras.sql @@ -9,7 +9,7 @@ CREATE TABLE `creature_template_npcbot_extras` ( `class` tinyint(3) unsigned NOT NULL DEFAULT '1', `race` tinyint(3) unsigned NOT NULL DEFAULT '1', PRIMARY KEY (`entry`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='NPC Bot Extras System'; -- ---------------------------- -- Records diff --git a/data/sql/base/db_world/creature_template_outfits.sql b/data/sql/base/db_world/creature_template_npcbot_outfits.sql similarity index 75% rename from data/sql/base/db_world/creature_template_outfits.sql rename to data/sql/base/db_world/creature_template_npcbot_outfits.sql index d9176a925abc38..bc14bbcbe09f34 100644 --- a/data/sql/base/db_world/creature_template_outfits.sql +++ b/data/sql/base/db_world/creature_template_npcbot_outfits.sql @@ -1,13 +1,13 @@ -- SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- --- Table structure for creature_template_outfits +-- Table structure for creature_template_npcbot_outfits -- ---------------------------- -DROP TABLE IF EXISTS `creature_template_outfits`; -CREATE TABLE IF NOT EXISTS `creature_template_outfits` ( +DROP TABLE IF EXISTS `creature_template_npcbot_outfits`; +CREATE TABLE IF NOT EXISTS `creature_template_npcbot_outfits` ( `entry` int(10) unsigned NOT NULL, `race` tinyint(3) unsigned NOT NULL DEFAULT '1', - `gender` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '0 for male, 1 for female', + `gender` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Male (0) or Female (1)', `skin` tinyint(3) unsigned NOT NULL DEFAULT '0', `face` tinyint(3) unsigned NOT NULL DEFAULT '0', `hair` tinyint(3) unsigned NOT NULL DEFAULT '0', @@ -25,11 +25,11 @@ CREATE TABLE IF NOT EXISTS `creature_template_outfits` ( `back` int(10) unsigned NOT NULL DEFAULT '0', `tabard` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`entry`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='NPC Bot Outfit System'; -- ---------------------------- -- Records -- ---------------------------- -INSERT INTO `creature_template_outfits` VALUES +INSERT INTO `creature_template_npcbot_outfits` VALUES ('70551', '2', '0', '0', '14', '9', '7', '5', '0', '0', '0', '0', '59194', '64674', '0', '36248', '0', '0', '0'), ('70552', '2', '0', '0', '14', '9', '7', '5', '0', '0', '0', '0', '59194', '64674', '0', '36248', '0', '0', '0'); diff --git a/data/sql/custom/db_characters/2023_05_16_00_characters_npcbot_gear_storage.sql b/data/sql/custom/db_characters/2023_05_16_00_characters_npcbot_gear_storage.sql deleted file mode 100644 index 32e9f89529f327..00000000000000 --- a/data/sql/custom/db_characters/2023_05_16_00_characters_npcbot_gear_storage.sql +++ /dev/null @@ -1,11 +0,0 @@ --- -SET FOREIGN_KEY_CHECKS=0; -DROP TABLE IF EXISTS `characters_npcbot_gear_storage`; -CREATE TABLE `characters_npcbot_gear_storage` ( - `guid` int(10) unsigned NOT NULL DEFAULT '0', - `item_guid` int(10) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`item_guid`), - KEY `existing_player` (`guid`), - CONSTRAINT `characters_npcbot_gear_storage_ibfk_1` FOREIGN KEY (`item_guid`) REFERENCES `item_instance` (`guid`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `existing_player` FOREIGN KEY (`guid`) REFERENCES `characters` (`guid`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Bot item storage system'; diff --git a/data/sql/custom/db_characters/2023_05_26_00_characters_npcbot_transmog.sql b/data/sql/custom/db_characters/2023_05_26_00_characters_npcbot_transmog.sql deleted file mode 100644 index a037563ba77954..00000000000000 --- a/data/sql/custom/db_characters/2023_05_26_00_characters_npcbot_transmog.sql +++ /dev/null @@ -1,2 +0,0 @@ --- -ALTER TABLE `characters_npcbot_transmog` MODIFY `fake_id` int(11) NOT NULL DEFAULT '-1' AFTER `item_id`; diff --git a/data/sql/custom/db_characters/2024_03_12_00_characters_npcbot.sql b/data/sql/custom/db_characters/2024_03_12_00_characters_npcbot.sql deleted file mode 100644 index 220cc7b5752c23..00000000000000 --- a/data/sql/custom/db_characters/2024_03_12_00_characters_npcbot.sql +++ /dev/null @@ -1,20 +0,0 @@ --- -/*!50003 DROP PROCEDURE IF EXISTS `sp__drop_column_if_exists`*/; -DELIMITER ;; -/*!50003 CREATE*/ -/*!50003 PROCEDURE `sp__drop_column_if_exists`(`@TABLE` varchar(100), `@COLUMN` varchar(100)) -BEGIN -DECLARE `@EXISTS` INT DEFAULT 0; -SELECT COUNT(*) INTO `@EXISTS` FROM `information_schema`.`columns`WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = `@TABLE` AND `COLUMN_NAME` = `@COLUMN`; -IF (`@EXISTS` > 0) THEN - ALTER TABLE `characters_npcbot` DROP COLUMN `hire_time`; -END IF; -END */;; - -DELIMITER ; - -CALL `sp__drop_column_if_exists`('characters_npcbot', 'hire_time'); - -DROP PROCEDURE IF EXISTS `sp__drop_column_if_exists`; - -ALTER TABLE `characters_npcbot` ADD `hire_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP AFTER `faction`;