root/trunk/sql/updates/0.7/3323.sql @ 2

Revision 2, 1.1 kB (checked in by yumileroy, 17 years ago)

[svn] * Proper SVN structure

Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00

Line 
1ALTER 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';
4
5UPDATE `character_pet`
6  SET `slot` = 0 WHERE `current` = 1;
7
8/* slot 3 =  for storing warlock and another not stabled pets */
9UPDATE `character_pet`
10  SET `slot` = 3 WHERE `current` = 0;
11
12/* current = (`slot`==0) */
13ALTER TABLE `character_pet` 
14  DROP COLUMN `current`;
15
16UPDATE `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`;
20
21ALTER TABLE `character` 
22  ADD COLUMN `stable_slots` tinyint(1) unsigned NOT NULL default '0';
23
24UPDATE `character`, (
25  SELECT `character_stable`.`owner` as `owner_slots`, MAX(`character_stable`.`slot`) as `slots` FROM `character_stable` GROUP BY `character_stable`.`owner`
26  ) as `stable_slots`
27  SET `character`.`stable_slots`= `stable_slots`.`slots`
28  WHERE `character`.`guid` = `stable_slots`.`owner_slots`;
29
30
31DROP TABLE IF EXISTS `character_stable`;
Note: See TracBrowser for help on using the browser.