Maintenance Queries thx to NCDB:
Code:
-- Delete vendors with none existing creatures/items.
DELETE FROM `vendors` WHERE `entry` not in (SELECT `entry` from `creature_proto`);
DELETE FROM `vendors` WHERE `item` not in (SELECT `entry` from `items`);
-- Delete waypoints with none existing spawns
DELETE FROM `creature_waypoints` WHERE `spawnid` not in (SELECT `id` from `creature_spawns`);
-- Delete trainers with none existing creatures ** New table **
DELETE FROM `trainer_spells` WHERE `entry` not in (SELECT `entry` from `creature_proto`);
DELETE FROM `trainer_defs` WHERE `entry` not in (SELECT `entry` from `creature_proto`);
-- Delete quest starter/finisher where quests doesn't exist
DELETE FROM `creature_quest_starter` WHERE `quest` not in (SELECT `entry` from `quests`);
DELETE FROM `creature_quest_finisher` WHERE `quest` not in (SELECT `entry` from `quests`);
DELETE FROM `gameobject_quest_starter` WHERE `quest` not in (SELECT `entry` from `quests`);
DELETE FROM `gameobject_quest_finisher` WHERE `quest` not in (SELECT `entry` from `quests`);
-- Delete quest starter/finisher where creature/gameobject doesn't exist
DELETE FROM `creature_quest_starter` WHERE `id` not in (SELECT `entry` from `creature_proto`);
DELETE FROM `creature_quest_finisher` WHERE `id` not in (SELECT `entry` from `creature_proto`);
DELETE FROM `gameobject_quest_starter` WHERE `id` not in (SELECT `entry` from `gameobject_names`);
DELETE FROM `gameobject_quest_finisher` WHERE `id` not in (SELECT `entry` from `gameobject_names`);
-- Delete loots that itemid not exists.
DELETE FROM `itemloot` WHERE `itemid` not in (SELECT `entry` from `items`);
DELETE FROM `objectloot` WHERE `itemid` not in (SELECT `entry` from `items`);
DELETE FROM `creatureloot` WHERE `itemid` not in (SELECT `entry` from `items`);
DELETE FROM `pickpocketingloot` WHERE `itemid` not in (SELECT `entry` from `items`);
DELETE FROM `fishingloot` WHERE `itemid` not in (SELECT `entry` from `items`);
DELETE FROM `skinningloot` WHERE `itemid` not in (SELECT `entry` from `items`);
DELETE FROM `prospectingloot` WHERE `itemid` not in (SELECT `entry` from `items`);
-- Delete loots that entryid not exists.
DELETE FROM `itemloot` WHERE `entryid` not in (SELECT `entry` from `items`);
DELETE FROM `prospectingloot` WHERE `entryid` not in (SELECT `entry` from `items`);
DELETE FROM `fishingloot` WHERE `entryid` not in (SELECT `Zone` from `fishing`);
DELETE FROM `objectloot` WHERE `entryid` not in (SELECT `entry` from `gameobject_names`);
DELETE FROM `creatureloot` WHERE `entryid` not in (SELECT `entry` from `creature_proto`);
DELETE FROM `pickpocketingloot` WHERE `entryid` not in (SELECT `entry` from `creature_proto`);
DELETE FROM `skinningloot` WHERE `entryid` not in (SELECT `entry` from `creature_proto`);
Query to order you tables again thx to NCDB:
Code:
ALTER TABLE `areatriggers` ORDER BY `entry` ASC;
ALTER TABLE `creature_spawns` ORDER BY `id` ASC;
ALTER TABLE `creature_quest_starter` ORDER BY `id` ASC, `quest` ASC;
ALTER TABLE `creature_proto` ORDER BY `entry` ASC;
ALTER TABLE `creature_names` ORDER BY `entry` ASC;
ALTER TABLE `gameobject_names` ORDER BY `entry` ASC;
ALTER TABLE `gameobject_quest_finisher` ORDER BY `id` ASC, `quest` ASC;
ALTER TABLE `gameobject_quest_starter` ORDER BY `id` ASC, `quest` ASC;
ALTER TABLE `gameobject_spawns` ORDER BY `id` ASC;
ALTER TABLE `itempages` ORDER BY `entry` ASC;
ALTER TABLE `items` ORDER BY `entry` ASC;
ALTER TABLE `npc_text` ORDER BY `entry` ASC;
ALTER TABLE `playercreateinfo_spells` ORDER BY `indexid` ASC;
ALTER TABLE `quests` ORDER BY `entry` ASC;
ALTER TABLE `recall` ORDER BY `name` ASC;
ALTER TABLE `vendors` ORDER BY `vendorGUID` ASC, `entry` ASC;
ALTER TABLE `weather` ORDER BY `zoneId` ASC;
these are verry nice too
forgot to add them and now i cant add to first post, it is too big xD
grtz