*Add some sql tools to merge two db. This is only a template and is pushed for dev use. Do not use it unless you understand it and know how to modify it.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-06-08 12:25:22 -05:00
parent d4576e4c27
commit 0c6df742ee
3 changed files with 20 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
Suppose your primary db is called "world", and you have another db called "world2". By running world_merge_xxx.sql you can copy some spawn points which do not exist in "world" from "world2" to "world".
If you want to apply a update pack to "world", first run world_remove_merged_xxx to remove the merged spawn points of "world2" from "world", then apply update packet, then re-apply world_merge_xxx.sql. Make sure to do that clean up every time you use a update pack on "world" or "world2". Otherwise your db will be messed up.
Do not use these sql unless you can understand them.

View File

@@ -0,0 +1,13 @@
DROP TABLE IF EXISTS merge_creature;
CREATE TABLE merge_creature
(guid_new INT NOT NULL AUTO_INCREMENT PRIMARY KEY)
SELECT * FROM world2.creature WHERE id NOT IN (SELECT DISTINCT id FROM creature);
ALTER TABLE merge_creature ADD INDEX guid (guid);
UPDATE merge_creature SET guid = guid_new + (SELECT MAX(guid) FROM creature);
ALTER TABLE merge_creature DROP COLUMN guid_new;
INSERT creature SELECT * FROM merge_creature;

View File

@@ -0,0 +1,2 @@
DELETE FROM creature WHERE guid IN (SELECT guid FROM merge_creature);
DROP TABLE IF EXISTS merge_creature;