Updated '2015_09_30_bots.sql' to alleviate import failures due to broken contraints

This commit is contained in:
Uleat 2015-10-13 14:00:51 -04:00
parent d3755cdb08
commit 285bd3a627
3 changed files with 99 additions and 72 deletions

View File

@ -1,5 +1,8 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50) EQEMu Changelog (Started on Sept 24, 2003 15:50)
------------------------------------------------------- -------------------------------------------------------
== 10/13/2015 ==
Uleat: Important update to 2015_09_30_bots.sql - fix for orphaned entries causing crashes during the conversion process
Note: Please visit the thread below if you encounter issues during the conversion process
== 10/12/2015 == == 10/12/2015 ==
Uleat: Implemented 'bots' database versioning Uleat: Implemented 'bots' database versioning

View File

@ -32,7 +32,7 @@
#define CURRENT_BINARY_DATABASE_VERSION 9087 #define CURRENT_BINARY_DATABASE_VERSION 9087
#ifdef BOTS #ifdef BOTS
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // temporarily disabled (9000) #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9000
#else #else
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0 #define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
#endif #endif

View File

@ -1,5 +1,5 @@
-- '2015_09_30_bots' sql script file -- '2015_09_30_bots' sql script file
-- current as of 10/09/2015 -- current as of 10/13/2015
-- --
-- Use eqemu_update.pl to administer this script -- Use eqemu_update.pl to administer this script
@ -277,9 +277,11 @@ BEGIN
`stance_id` `stance_id`
) )
SELECT SELECT
`BotID`, bs.`BotID`,
`StanceID` bs.`StanceID`
FROM `botstances`; FROM `botstances` bs
INNER JOIN `bot_data` bd
ON bs.`BotID` = bd.`bot_id`;
RENAME TABLE `botstances` TO `botstances_old`; RENAME TABLE `botstances` TO `botstances_old`;
END IF; END IF;
@ -298,10 +300,12 @@ BEGIN
`timer_value` `timer_value`
) )
SELECT SELECT
`BotID`, bt.`BotID`,
`TimerID`, bt.`TimerID`,
`Value` bt.`Value`
FROM `bottimers`; FROM `bottimers` bt
INNER JOIN `bot_data` bd
ON bt.`BotID` = bd.`bot_id`;
RENAME TABLE `bottimers` TO `bottimers_old`; RENAME TABLE `bottimers` TO `bottimers_old`;
END IF; END IF;
@ -349,21 +353,23 @@ BEGIN
`persistent` `persistent`
) )
SELECT SELECT
`BotBuffId`, bb.`BotBuffId`,
`BotId`, bb.`BotId`,
`SpellId`, bb.`SpellId`,
`CasterLevel`, bb.`CasterLevel`,
`DurationFormula`, bb.`DurationFormula`,
`TicsRemaining`, bb.`TicsRemaining`,
`PoisonCounters`, bb.`PoisonCounters`,
`DiseaseCounters`, bb.`DiseaseCounters`,
`CurseCounters`, bb.`CurseCounters`,
`CorruptionCounters`, bb.`CorruptionCounters`,
`HitCount`, bb.`HitCount`,
`MeleeRune`, bb.`MeleeRune`,
`MagicRune`, bb.`MagicRune`,
`Persistent` bb.`Persistent`
FROM `botbuffs`; FROM `botbuffs` bb
INNER JOIN `bot_data` bd
ON bb.`BotId` = bd.`bot_id`;
IF ((SELECT COUNT(*) FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botbuffs' AND `COLUMN_NAME` = 'dot_rune') > 0) THEN IF ((SELECT COUNT(*) FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botbuffs' AND `COLUMN_NAME` = 'dot_rune') > 0) THEN
UPDATE `bot_buffs` bb UPDATE `bot_buffs` bb
@ -446,19 +452,21 @@ BEGIN
`augment_5` `augment_5`
) )
SELECT SELECT
`BotInventoryID`, bi.`BotInventoryID`,
`BotID`, bi.`BotID`,
`SlotID`, bi.`SlotID`,
`ItemID`, bi.`ItemID`,
`charges`, bi.`charges`,
`color`, bi.`color`,
`instnodrop`, bi.`instnodrop`,
`augslot1`, bi.`augslot1`,
`augslot2`, bi.`augslot2`,
`augslot3`, bi.`augslot3`,
`augslot4`, bi.`augslot4`,
`augslot5` bi.`augslot5`
FROM `botinventory`; FROM `botinventory` bi
INNER JOIN `bot_data` bd
ON bi.`BotID` = bd.`bot_id`;
IF ((SELECT COUNT(*) FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botinventory' AND `COLUMN_NAME` = 'augslot6') > 0) THEN IF ((SELECT COUNT(*) FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botinventory' AND `COLUMN_NAME` = 'augslot6') > 0) THEN
UPDATE `bot_inventories` bi UPDATE `bot_inventories` bi
@ -493,13 +501,15 @@ BEGIN
`hp` `hp`
) )
SELECT SELECT
`BotPetsId`, bp.`BotPetsId`,
`PetId`, bp.`PetId`,
`BotId`, bp.`BotId`,
`Name`, bp.`Name`,
`Mana`, bp.`Mana`,
`HitPoints` bp.`HitPoints`
FROM `botpets`; FROM `botpets` bp
INNER JOIN `bot_data` bd
ON bp.`BotId` = bd.`bot_id`;
RENAME TABLE `botpets` TO `botpets_old`; RENAME TABLE `botpets` TO `botpets_old`;
END IF; END IF;
@ -523,12 +533,14 @@ BEGIN
`duration` `duration`
) )
SELECT SELECT
`BotPetBuffId`, bpb.`BotPetBuffId`,
`BotPetsId`, bpb.`BotPetsId`,
`SpellId`, bpb.`SpellId`,
`CasterLevel`, bpb.`CasterLevel`,
`Duration` bpb.`Duration`
FROM `botpetbuffs`; FROM `botpetbuffs` bpb
INNER JOIN `bot_pets` bp
ON bpb.`BotPetsId` = bp.`pets_index`;
RENAME TABLE `botpetbuffs` TO `botpetbuffs_old`; RENAME TABLE `botpetbuffs` TO `botpetbuffs_old`;
END IF; END IF;
@ -548,10 +560,12 @@ BEGIN
`item_id` `item_id`
) )
SELECT SELECT
`BotPetInventoryId`, bpi.`BotPetInventoryId`,
`BotPetsId`, bpi.`BotPetsId`,
`ItemId` bpi.`ItemId`
FROM `botpetinventory`; FROM `botpetinventory` bpi
INNER JOIN `bot_pets` bp
ON bpi.`BotPetsId` = bp.`pets_index`;
RENAME TABLE `botpetinventory` TO `botpetinventory_old`; RENAME TABLE `botpetinventory` TO `botpetinventory_old`;
END IF; END IF;
@ -571,10 +585,12 @@ BEGIN
`group_name` `group_name`
) )
SELECT SELECT
`BotGroupId`, bg.`BotGroupId`,
`BotGroupLeaderBotId`, bg.`BotGroupLeaderBotId`,
`BotGroupName` bg.`BotGroupName`
FROM `botgroup`; FROM `botgroup` bg
INNER JOIN `bot_data` bd
ON bg.`BotGroupLeaderBotId` = bd.`bot_id`;
RENAME TABLE `botgroup` TO `botgroup_old`; RENAME TABLE `botgroup` TO `botgroup_old`;
END IF; END IF;
@ -596,10 +612,14 @@ BEGIN
`bot_id` `bot_id`
) )
SELECT SELECT
`BotGroupMemberId`, bgm.`BotGroupMemberId`,
`BotGroupId`, bgm.`BotGroupId`,
`BotId` bgm.`BotId`
FROM `botgroupmembers`; FROM `botgroupmembers` bgm
INNER JOIN `bot_groups` bg
ON bgm.`BotGroupId` = bg.`groups_index`
INNER JOIN `bot_data` bd
ON bgm.`BotId` = bd.`bot_id`;
RENAME TABLE `botgroupmembers` TO `botgroupmembers_old`; RENAME TABLE `botgroupmembers` TO `botgroupmembers_old`;
END IF; END IF;
@ -629,16 +649,20 @@ BEGIN
`alt` `alt`
) )
SELECT SELECT
`char_id`, bgm.`char_id`,
`guild_id`, bgm.`guild_id`,
`rank`, bgm.`rank`,
`tribute_enable`, bgm.`tribute_enable`,
`total_tribute`, bgm.`total_tribute`,
`last_tribute`, bgm.`last_tribute`,
`banker`, bgm.`banker`,
`public_note`, bgm.`public_note`,
`alt` bgm.`alt`
FROM `botguildmembers`; FROM `botguildmembers` bgm
INNER JOIN `guilds` g
ON bgm.`guild_id` = g.`id`
INNER JOIN `bot_data` bd
ON bgm.`char_id` = bd.`bot_id`;
RENAME TABLE `botguildmembers` TO `botguildmembers_old`; RENAME TABLE `botguildmembers` TO `botguildmembers_old`;
END IF; END IF;