Skip to content

Commit

Permalink
NPCBots: Fix hire_time default value 2
Browse files Browse the repository at this point in the history
  • Loading branch information
trickerer committed Mar 13, 2024
1 parent 5f5ac2f commit 9ac2bcd
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions sql/Bots/updates/characters/2024_03_12_00_characters_npcbot.sql
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`;

0 comments on commit 9ac2bcd

Please sign in to comment.