forked from TrinityCore/TrinityCore
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NPCBots: Fix
hire_time
default value 2
- Loading branch information
Showing
1 changed file
with
19 additions
and
2 deletions.
There are no files selected for viewing
21 changes: 19 additions & 2 deletions
21
sql/Bots/updates/characters/2024_03_12_00_characters_npcbot.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
-- | ||
ALTER TABLE `characters_npcbot` ADD `hire_time` timestamp NULL DEFAULT '1970-01-01 07:00:01' AFTER `faction`; | ||
UPDATE `characters_npcbot` SET `hire_time` = CURRENT_TIMESTAMP() WHERE `owner` != 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`; |