diff options
author | megamage <none@none> | 2009-06-08 12:25:22 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-06-08 12:25:22 -0500 |
commit | 0c6df742eed8dcf91e79c7d25ac2e5c72fea518f (patch) | |
tree | 827776a70dd527fa6a3c52aee271876a43e742cf /sql/tools | |
parent | d4576e4c2711a6b4ae04a2645fb9210fb39fa056 (diff) |
*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
Diffstat (limited to 'sql/tools')
-rw-r--r-- | sql/tools/world_merge_db/readme.txt | 5 | ||||
-rw-r--r-- | sql/tools/world_merge_db/world_merge_creature.sql | 13 | ||||
-rw-r--r-- | sql/tools/world_merge_db/world_remove_merged_creature.sql | 2 |
3 files changed, 20 insertions, 0 deletions
diff --git a/sql/tools/world_merge_db/readme.txt b/sql/tools/world_merge_db/readme.txt new file mode 100644 index 00000000000..43dd5916326 --- /dev/null +++ b/sql/tools/world_merge_db/readme.txt @@ -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.
\ No newline at end of file diff --git a/sql/tools/world_merge_db/world_merge_creature.sql b/sql/tools/world_merge_db/world_merge_creature.sql new file mode 100644 index 00000000000..810031e6d3e --- /dev/null +++ b/sql/tools/world_merge_db/world_merge_creature.sql @@ -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; diff --git a/sql/tools/world_merge_db/world_remove_merged_creature.sql b/sql/tools/world_merge_db/world_remove_merged_creature.sql new file mode 100644 index 00000000000..c9b95bd9f17 --- /dev/null +++ b/sql/tools/world_merge_db/world_remove_merged_creature.sql @@ -0,0 +1,2 @@ +DELETE FROM creature WHERE guid IN (SELECT guid FROM merge_creature); +DROP TABLE IF EXISTS merge_creature; |