refactor(DB): Consolidate small SQL files by table per bracket (#468)

Merge small SQL files that target the same database table and share the
same bracket prefix into consolidated files. This reduces file count by
22 (from 230 to 208) while preserving all SQL content and comments.
Document SQL file naming conventions and organization rules in README.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Andrew 2026-03-23 01:10:45 -03:00 committed by GitHub
parent 6d0cffb146
commit fe93b0bbd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 184 additions and 135 deletions

View file

@ -12,10 +12,32 @@ SQL files can be loaded into your database once you have enabled the auto DB upd
**WARNING:** SQL files cannot be "unloaded" once executed. If you configure the system to use the 30-39 level bracket and later change it to the 20-29 bracket, the SQL files from the 30-39 bracket will still be in your database. To undo changes made by these SQL files, create a new SQL file to restore the previous state in another bracket.
**WARNING:** If you enable bracket 20-29 but DO NOT enable the bracket that reverts the SQL applied at 20-29, the changes will remain in your database leading to POLLUTION! Easiest way to revert all changes is to uninstall the module and reset your world database.
**WARNING:** If you enable bracket 20-29 but DO NOT enable the bracket that reverts the SQL applied at 20-29, the changes will remain in your database leading to POLLUTION! Easiest way to revert all changes is to uninstall the module and reset your world database.
**DO NOT ENABLE BRACKETS IF YOU ARE NOT SURE YOU WANT TO USE THEM. IT WILL LEAD TO DATABASE POLLUTION IF NOT REVERTED PROPERLY. IF YOU DO NOT KNOW HOW TO REVERT CHANGES, RESET YOUR WORLD DATABASE**
### SQL File Naming Convention
SQL files follow a naming convention that encodes the originating bracket and the target database table:
```
progression_[bracket]_[table_or_theme].sql
```
- **`[bracket]`** identifies which bracket's content this file relates to (e.g., `0`, `61_64`, `80_1`).
- **`[table_or_theme]`** describes what the file modifies (e.g., `creature`, `disables`, `item_template`, `brewfest`).
A bracket's directory may contain files with a different bracket prefix. These are "down" files that revert changes made by a previous bracket. For example, `Bracket_61_64/` may contain `progression_0_item_loot_template_down.sql`, which reverts changes originally applied by `Bracket_0`.
### SQL File Organization Rules
When adding or modifying SQL files, follow these rules to keep the module organized:
1. **Group by table**: Multiple small changes to the same database table within the same bracket prefix should be consolidated into a single file (e.g., `progression_61_64_item_template.sql` instead of separate files per item group).
2. **Keep thematic files intact**: Event-related files (e.g., `brewfest`, `hallows_end`, `love_in_air`) that span multiple tables should remain as standalone files since they represent a logical unit.
3. **Do not mix bracket prefixes**: Never merge SQL from different bracket prefixes into one file. Each file's bracket prefix indicates which bracket's changes it applies or reverts, and this must remain clear.
4. **Keep large files separate**: Files over ~50 lines should generally remain standalone rather than being merged with other files.
## C++ SCRIPTS
C++ scripts can also be automatically loaded based on the bracket level. To do this, copy and paste the C++ script you want to modify into the appropriate folder, make your changes, and create a new script loader function. You do not need to change the script's name in the database or the C++ script's name (only the script object name).

View file

@ -0,0 +1,40 @@
-- Hide Gangrenus which is accesible from exploits
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1`=29207 AND `guid`=125760;
-- Hide Karazhan NPCs
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1` IN
(
7370, -- Restless Shade
12377, -- Wailing Spectre
12378, -- Damned Soul
12379, -- Unliving Caretaker
12380, -- Unliving Resident
17613, -- Archmage Alturus
18253, -- Archmage Lery
18255 -- Apprentice Darius
);
-- Hide the 11 cultists in Un'Goro (Bracket 70_4)
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1` IN (28602, 28601) AND `guid` IN (209102,209103,209104,209105,209106,209107,209108,209109,209110,209111,209112);
-- Hide Emalon, Koralon and Toravon at Vault of Archavon
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1` IN (
33993, -- Emalon
35013, -- Koralon
38433 -- Toravon
);
-- Hide World Bosses
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1` IN (
6109, -- Azuregos
12397, -- Lord Kazzak
14890, -- Ysondre
14889, -- Lethon
14888, -- Emeriss
14887, -- Taerar
18728, -- Doom Lord Kazzak
17711 -- Doomwalker
);
-- Replace Kor'Kron Overseer with Undercity Guardian until ICC
UPDATE `creature` SET `id1`=5624, `equipment_id`=0 WHERE `map`=0 AND `id1`=36213;

View file

@ -1,2 +0,0 @@
-- Hide Gangrenus which is accesible from exploits
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1`=29207 AND `guid`=125760;

View file

@ -1,12 +0,0 @@
-- Hide Karazhan NPCs
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1` IN
(
7370, -- Restless Shade
12377, -- Wailing Spectre
12378, -- Damned Soul
12379, -- Unliving Caretaker
12380, -- Unliving Resident
17613, -- Archmage Alturus
18253, -- Archmage Lery
18255 -- Apprentice Darius
);

View file

@ -1,2 +0,0 @@
-- Hide the 11 cultists in Un'Goro (Bracket 70_4)
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1` IN (28602, 28601) AND `guid` IN (209102,209103,209104,209105,209106,209107,209108,209109,209110,209111,209112);

View file

@ -1,6 +0,0 @@
-- Hide Emalon, Koralon and Toravon at Vault of Archavon
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1` IN (
33993, -- Emalon
35013, -- Koralon
38433 -- Toravon
);

View file

@ -1,11 +0,0 @@
-- Hide World Bosses
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1` IN (
6109, -- Azuregos
12397, -- Lord Kazzak
14890, -- Ysondre
14889, -- Lethon
14888, -- Emeriss
14887, -- Taerar
18728, -- Doom Lord Kazzak
17711 -- Doomwalker
);

View file

@ -1,2 +0,0 @@
-- Replace Kor'Kron Overseer with Undercity Guardian until ICC
UPDATE `creature` SET `id1`=5624, `equipment_id`=0 WHERE `map`=0 AND `id1`=36213;

View file

@ -1,2 +1,7 @@
-- 61-64 level range - The Blood Furnace, Hellfire Ramparts, The Underbog, The Slave Pens, Mana Tombs
UPDATE `disables` SET `flags`=`flags`&~1 WHERE `entry` IN (542, 543, 546, 547, 557);
-- Disable BT attunement quest chain
DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (10944);
INSERT INTO `disables` (`sourceType`, `entry`, `comment`) VALUES
(1, 10944, 'The Secret Compromised');

View file

@ -1,4 +0,0 @@
-- Disable BT attunement quest chain
DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (10944);
INSERT INTO `disables` (`sourceType`, `entry`, `comment`) VALUES
(1, 10944, 'The Secret Compromised');

View file

@ -1,3 +1,19 @@
-- Set Primal Nether and Nether Vortex to BoP
UPDATE `item_template` SET `bonding`=1 WHERE `entry` IN (
23572, -- Primal Nether
30183 -- Nether Vortex
);
-- Set Dungeon Heroic Keys to require Revered with their respective factions
UPDATE `item_template` SET `RequiredReputationRank` = 6 WHERE `entry` IN (
30622, -- Hellfire Citadel (Alliance)
30623, -- Coilfang Resevoir
30633, -- Auchindoun
30634, -- Tempest Key
30635, -- Caverns of Time
30637 -- Hellfire Citadel (Horde)
);
-- Set World Boss loot to BoP until Sunwell
UPDATE `item_template` SET `bonding`=1 WHERE `entry` IN (
30732, -- Exodar Life-Staff

View file

@ -1,5 +0,0 @@
-- Set Primal Nether and Nether Vortex to BoP
UPDATE `item_template` SET `bonding`=1 WHERE `entry` IN (
23572, -- Primal Nether
30183 -- Nether Vortex
);

View file

@ -1,9 +0,0 @@
-- Set Dungeon Heroic Keys to require Revered with their respective factions
UPDATE `item_template` SET `RequiredReputationRank` = 6 WHERE `entry` IN (
30622, -- Hellfire Citadel (Alliance)
30623, -- Coilfang Resevoir
30633, -- Auchindoun
30634, -- Tempest Key
30635, -- Caverns of Time
30637 -- Hellfire Citadel (Horde)
);

View file

@ -1,5 +0,0 @@
UPDATE `creature` SET `phasemask` = 1 WHERE `id1` IN (
-- Tier 4
20616, -- Asuur (Aldor)
20613 -- Arodis Sunblade (Scryer)
);

View file

@ -1,4 +1,11 @@
-- Disable Arena Vendors from Netherstorm
-- Reveal Tier 4 token vendors
UPDATE `creature` SET `phasemask` = 1 WHERE `id1` IN (
-- Tier 4
20616, -- Asuur (Aldor)
20613 -- Arodis Sunblade (Scryer)
);
-- Re-enable Arena Vendors from Netherstorm
UPDATE `creature_template` SET `npcflag`=`npcflag`|128 WHERE `entry` IN (
26352, -- Big Zokk Torquewrench
32355, -- Big Zokk Torquewrench

View file

@ -1,4 +0,0 @@
-- Philanthropist should drop gold
UPDATE `creature_template` SET `mingold` = 110000, `maxgold` = 130000 WHERE (`entry` = 16470);
-- No badge of justice from chess
DELETE FROM `gameobject_loot_template` WHERE `Item` = 29434 AND `Entry` = 20712;

View file

@ -1,3 +1,9 @@
-- Philanthropist should drop gold
UPDATE `creature_template` SET `mingold` = 110000, `maxgold` = 130000 WHERE (`entry` = 16470);
-- No badge of justice from chess
DELETE FROM `gameobject_loot_template` WHERE `Item` = 29434 AND `Entry` = 20712;
-- Karazhan enchant drops
DELETE FROM `creature_loot_template` WHERE `Entry` IN (15688, 15687, 16524) AND `Item` IN (22560, 22561, 22559);
INSERT INTO `creature_loot_template` (`Entry`, `Item`, `Reference`, `Chance`, `QuestRequired`, `LootMode`, `GroupId`, `MinCount`, `MaxCount`, `Comment`) VALUES
(15687, 22559, 0, 4, 0, 1, 0, 1, 1, 'Moroes - Formula: Enchant Weapon - Mongoose'),

View file

@ -1,5 +0,0 @@
UPDATE `creature` SET `phasemask` = 1 WHERE `id1` IN (
-- Tier 5
21906, -- Kelara (Aldor)
21905 -- Veynna Dawnstar (Scryer)
);

View file

@ -1,2 +0,0 @@
-- Enable BT attunement quest chain
DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (10944);

View file

@ -1,2 +0,0 @@
-- Remove attunement requirements for dungeons and Karazhan
DELETE FROM `dungeon_access_requirements` WHERE `comment` LIKE 'Progression:%' AND `dungeon_access_id` IN (33,34,48,49,54,55,29);

View file

@ -1,9 +0,0 @@
-- Restore Dungeon Heroic Keys to require Honored with their respective factions
UPDATE `item_template` SET `RequiredReputationRank` = 5 WHERE `entry` IN (
30622, -- Hellfire Citadel (Alliance)
30623, -- Coilfang Resevoir
30633, -- Auchindoun
30634, -- Tempest Key
30635, -- Caverns of Time
30637 -- Hellfire Citadel (Horde)
);

View file

@ -1,3 +1,26 @@
-- Reveal Tier 5 token vendors
UPDATE `creature` SET `phasemask` = 1 WHERE `id1` IN (
-- Tier 5
21906, -- Kelara (Aldor)
21905 -- Veynna Dawnstar (Scryer)
);
-- Enable BT attunement quest chain
DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (10944);
-- Remove attunement requirements for dungeons and Karazhan
DELETE FROM `dungeon_access_requirements` WHERE `comment` LIKE 'Progression:%' AND `dungeon_access_id` IN (33,34,48,49,54,55,29);
-- Restore Dungeon Heroic Keys to require Honored with their respective factions
UPDATE `item_template` SET `RequiredReputationRank` = 5 WHERE `entry` IN (
30622, -- Hellfire Citadel (Alliance)
30623, -- Coilfang Resevoir
30633, -- Auchindoun
30634, -- Tempest Key
30635, -- Caverns of Time
30637 -- Hellfire Citadel (Horde)
);
-- Restore following TBC items from trainers (re-added in Black Temple)
-- DELETE FROM `npc_trainer` WHERE `SpellID` IN (
-- 36257, -- Bulwark of the Ancient Kings

View file

@ -1,4 +0,0 @@
UPDATE `creature` SET `phasemask` = 1 WHERE `id1` IN (
-- Tier 6
23381 -- Tydormu
);

View file

@ -1,3 +1,12 @@
-- Reveal Tier 6 token vendor
UPDATE `creature` SET `phasemask` = 1 WHERE `id1` IN (
-- Tier 6
23381 -- Tydormu
);
-- Remove attunement requirement for The Eye
DELETE FROM `dungeon_access_requirements` WHERE `comment` LIKE 'Progression:%' AND `dungeon_access_id` IN (33,34,48,49,54,55,29,46,47);
-- Restore quest that unlocks Netherwing (previous chain kept open) and following quests
DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (11012,11013,11015,11016,11017,11018,11020,11035,11041,11049,11050,11053,11054,11055,11064,11067,11068,11069,11070,11071,11075,11076,11077,11081,11082,11083,11084,11086,11089,11090,11092,11094,11097,11099,11101,11107,11108);
@ -13,3 +22,8 @@ DELETE FROM `disables` WHERE `sourceType`=10 AND `entry` IN (32427, 32464, 32468
-- Set Sludge-Covered Object to Quality back to 1
UPDATE `item_template` SET `Quality` = 1 WHERE (`entry` = 32724);
-- Remove The Tempest Key from the rewards of Trial of the Naaru: Magtheridon
UPDATE `quest_template` SET `RewardItem2` = 0, `RewardAmount2` = 0 WHERE (`ID` = 13430);
-- Removes The Mark of Vashj spell to The Cudgel of Kar'desh (cosmetic)
UPDATE `quest_template` SET `RewardSpell` = 0 WHERE (`ID` = 13431);

View file

@ -1,2 +0,0 @@
-- Remove attunement requirement for The Eye
DELETE FROM `dungeon_access_requirements` WHERE `comment` LIKE 'Progression:%' AND `dungeon_access_id` IN (33,34,48,49,54,55,29,46,47);

View file

@ -1,4 +0,0 @@
-- Remove The Tempest Key from the rewards of Trial of the Naaru: Magtheridon
UPDATE `quest_template` SET `RewardItem2` = 0, `RewardAmount2` = 0 WHERE (`ID` = 13430);
-- Removes The Mark of Vashj spell to The Cudgel of Kar'desh (cosmetic)
UPDATE `quest_template` SET `RewardSpell` = 0 WHERE (`ID` = 13431);

View file

@ -1,11 +0,0 @@
-- TBC Phase 3 - Battle for Mount Hyjal
DELETE FROM `creature_loot_template` WHERE `Entry` = 238720;
INSERT INTO `creature_loot_template` (`Entry`, `Item`, `Reference`, `Chance`, `QuestRequired`, `LootMode`, `GroupId`, `MinCount`, `MaxCount`, `Comment`) VALUES
(238720,38289,0,0,0,1,1,1,1,'Coren Direbrew - Coren Lucky Coin'),
(238720,38288,0,0,0,1,1,1,1,'Coren Direbrew - Direbrew Hops'),
(238720,38290,0,0,0,1,1,1,1,'Coren Direbrew - Dark Iron Smoking Pipe'),
(238720,38287,0,0,0,1,1,1,1,'Coren Direbrew - Empty Mug of Direbrew'),
(238720,37128,0,0,0,1,1,1,1,'Coren Direbrew - Belebrew Charm'),
(238720,37127,0,0,0,1,1,1,1,'Coren Direbrew - Brightbrew Charm');
UPDATE `creature_template` SET `lootid` = 238720 WHERE `entry` = 23872;

View file

@ -1,3 +1,16 @@
-- Coren Direbrew trinkets (TBC era)
DELETE FROM `creature_loot_template` WHERE `Entry` = 238720;
INSERT INTO `creature_loot_template` (`Entry`, `Item`, `Reference`, `Chance`, `QuestRequired`, `LootMode`, `GroupId`, `MinCount`, `MaxCount`, `Comment`) VALUES
(238720,38289,0,0,0,1,1,1,1,'Coren Direbrew - Coren Lucky Coin'),
(238720,38288,0,0,0,1,1,1,1,'Coren Direbrew - Direbrew Hops'),
(238720,38290,0,0,0,1,1,1,1,'Coren Direbrew - Dark Iron Smoking Pipe'),
(238720,38287,0,0,0,1,1,1,1,'Coren Direbrew - Empty Mug of Direbrew'),
(238720,37128,0,0,0,1,1,1,1,'Coren Direbrew - Belebrew Charm'),
(238720,37127,0,0,0,1,1,1,1,'Coren Direbrew - Brightbrew Charm');
UPDATE `creature_template` SET `lootid` = 238720 WHERE `entry` = 23872;
-- Headless Horseman loot (TBC era)
UPDATE `creature_template` SET `lootid` = 236820 WHERE `entry` = 23682;
DELETE FROM `creature_loot_template` WHERE `Entry` = 236820;

View file

@ -1,5 +0,0 @@
-- Remove BoP from Primal Nether and Nether Vortex
UPDATE `item_template` SET `bonding`=0 WHERE `entry` IN (
23572, -- Primal Nether
30183 -- Nether Vortex
);

View file

@ -1,24 +0,0 @@
-- Set World Boss loot to BoP until Sunwell
UPDATE `item_template` SET `bonding`=2 WHERE `entry` IN (
30732, -- Exodar Life-Staff
30733, -- Hope Ender
30734, -- Leggings of the Seventh Circle
30735, -- Ancient Spellcloak of the Highborne
30736, -- Ring of Flowing Light
30737, -- Gold-Leaf Wildboots
30738, -- Ring of Reciprocity
30739, -- Scaled Greaves of the Marksman
30740, -- Ripfiend Shoulderplates
30741, -- Topaz-Studded Battlegrips
30722, -- Ethereum Nexus-Reaver
30723, -- Talon of the Tempest
30724, -- Barrel-Blade Longrifle
30725, -- Anger-Spark Gloves
30726, -- Archaic Charm of Presence
30727, -- Gilded Trousers of Benediction
30728, -- Fathom-Helm of the Deeps
30729, -- Black-Iron Battlecloak
30730, -- Terrorweave Tunic
30731 -- Faceguard of the Endless Watch
);

View file

@ -48,3 +48,34 @@ UPDATE `item_template` SET `Flags`=`Flags`&~524288 WHERE `entry` IN (
30583, -- Timeless Tanzanite (3)
30564 -- Veiled Tanzanite
);
-- Remove BoP from Primal Nether and Nether Vortex
UPDATE `item_template` SET `bonding`=0 WHERE `entry` IN (
23572, -- Primal Nether
30183 -- Nether Vortex
);
-- Set World Boss loot to BoE
UPDATE `item_template` SET `bonding`=2 WHERE `entry` IN (
30732, -- Exodar Life-Staff
30733, -- Hope Ender
30734, -- Leggings of the Seventh Circle
30735, -- Ancient Spellcloak of the Highborne
30736, -- Ring of Flowing Light
30737, -- Gold-Leaf Wildboots
30738, -- Ring of Reciprocity
30739, -- Scaled Greaves of the Marksman
30740, -- Ripfiend Shoulderplates
30741, -- Topaz-Studded Battlegrips
30722, -- Ethereum Nexus-Reaver
30723, -- Talon of the Tempest
30724, -- Barrel-Blade Longrifle
30725, -- Anger-Spark Gloves
30726, -- Archaic Charm of Presence
30727, -- Gilded Trousers of Benediction
30728, -- Fathom-Helm of the Deeps
30729, -- Black-Iron Battlecloak
30730, -- Terrorweave Tunic
30731 -- Faceguard of the Endless Watch
);

View file

@ -0,0 +1,5 @@
-- Phase out various NPCs
UPDATE `creature` SET `phaseMask` = 2 WHERE `id1` IN (40160, 32294, 32296, 39173, 39172);
-- Phase out Frozo the Renowned
UPDATE `creature` SET `phaseMask` = 2 WHERE `guid`=202846 AND `id1` = 40160;

View file

@ -1,2 +0,0 @@
-- Removes frozo's items
UPDATE `creature` SET `phaseMask` = 2 WHERE `guid`=202846 AND `id1` = 40160;

View file

@ -1 +0,0 @@
UPDATE `creature` SET `phaseMask` = 2 WHERE `id1` IN (40160, 32294, 32296, 39173, 39172);