server/sql/updates/10254_01_characters_auctionhouse.sql
VladimirMangos e3befa2072 [10254] Remove dependence auction data from auctioneer guid.
* Field `auctioneerguid` replaced by `houseid` and table reanmed to `auction`
  (it list auctions and `id` is auction id).
* Update related code.

* SQL update fill `houseid` field by old `auctioneerguid`
  BUT: SQL update expect that you world DB named `mangos`.
  If this not true for your case you need modify SQL update BEFORE APPLY
  in 2 placed in part "mangos.creature AS c, mangos.creature_template AS ct"

* Another small possitive result: now possible easy select auctions related
  to some auction store (1-3 is one team actions, 4-6 another team auction,
  and 7 is neutral auction store for both teams
2010-07-24 01:45:59 +04:00

30 lines
1.4 KiB
SQL

ALTER TABLE character_db_version CHANGE COLUMN required_10160_02_characters_pet_aura required_10254_01_characters_auctionhouse bit;
ALTER TABLE auctionhouse
ADD COLUMN houseid int(11) unsigned NOT NULL default '0' AFTER id;
UPDATE auctionhouse, mangos.creature AS c, mangos.creature_template AS ct
SET houseid =
CASE ct.faction_A
WHEN 12 THEN 1 /* human */
WHEN 29 THEN 6 /* orc, and generic for horde */
WHEN 55 THEN 2 /* dwarf/gnome, and generic for alliance */
WHEN 68 THEN 4 /* undead */
WHEN 80 THEN 3 /* n-elf */
WHEN 104 THEN 5 /* trolls */
WHEN 120 THEN 7 /* booty bay, neutral */
WHEN 474 THEN 7 /* gadgetzan, neutral */
WHEN 534 THEN 2 /* Alliance Generic */
WHEN 855 THEN 7 /* everlook, neutral */
WHEN 1604 THEN 6 /* b-elfs, */
WHEN 1638 THEN 2 /* exodar, alliance */
ELSE 0 /* auction will canceled at loading */
END
WHERE auctionhouse.auctioneerguid = c.guid AND c.id = ct.entry;
ALTER TABLE auctionhouse
DROP COLUMN auctioneerguid;
DROP TABLE IF EXISTS auction;
RENAME TABLE auctionhouse TO auction;