1 ALTER TABLE `character_pet`
2 ADD COLUMN `slot` tinyint(1) unsigned NOT NULL default '0',
3 CHANGE COLUMN `id` `id` int(11) unsigned NOT NULL default '0';
6 SET `slot` = 0 WHERE `current` = 1;
8 /* slot 3 = for storing warlock and another not stabled pets */
10 SET `slot` = 3 WHERE `current` = 0;
12 /* current = (`slot`==0) */
13 ALTER TABLE `character_pet`
14 DROP COLUMN `current`;
16 UPDATE `character_pet`, `character_stable`
17 SET `character_pet`.`slot` =`character_stable`.`slot`
18 WHERE `character_pet`.`id`=`character_stable`.`petnumber`
19 AND `character_pet`.`owner`=`character_stable`.`owner` AND `character_pet`.`id`=`character_stable`.`petnumber`;
21 ALTER TABLE `character`
22 ADD COLUMN `stable_slots` tinyint(1) unsigned NOT NULL default '0';
25 SELECT `character_stable`.`owner` as `owner_slots`, MAX(`character_stable`.`slot`) as `slots` FROM `character_stable` GROUP BY `character_stable`.`owner`
27 SET `character`.`stable_slots`= `stable_slots`.`slots`
28 WHERE `character`.`guid` = `stable_slots`.`owner_slots`;
31 DROP TABLE IF EXISTS `character_stable`;