Skip to content

Commit fe93b0b

Browse files
Nyeriahclaude
andauthored
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>
1 parent 6d0cffb commit fe93b0b

34 files changed

Lines changed: 184 additions & 135 deletions

File tree

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,32 @@ SQL files can be loaded into your database once you have enabled the auto DB upd
1212

1313
**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.
1414

15-
**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.
15+
**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.
1616

1717
**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**
1818

19+
### SQL File Naming Convention
20+
21+
SQL files follow a naming convention that encodes the originating bracket and the target database table:
22+
23+
```
24+
progression_[bracket]_[table_or_theme].sql
25+
```
26+
27+
- **`[bracket]`** identifies which bracket's content this file relates to (e.g., `0`, `61_64`, `80_1`).
28+
- **`[table_or_theme]`** describes what the file modifies (e.g., `creature`, `disables`, `item_template`, `brewfest`).
29+
30+
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`.
31+
32+
### SQL File Organization Rules
33+
34+
When adding or modifying SQL files, follow these rules to keep the module organized:
35+
36+
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).
37+
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.
38+
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.
39+
4. **Keep large files separate**: Files over ~50 lines should generally remain standalone rather than being merged with other files.
40+
1941
## C++ SCRIPTS
2042

2143
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).
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
-- Hide Gangrenus which is accesible from exploits
2+
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1`=29207 AND `guid`=125760;
3+
4+
-- Hide Karazhan NPCs
5+
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1` IN
6+
(
7+
7370, -- Restless Shade
8+
12377, -- Wailing Spectre
9+
12378, -- Damned Soul
10+
12379, -- Unliving Caretaker
11+
12380, -- Unliving Resident
12+
17613, -- Archmage Alturus
13+
18253, -- Archmage Lery
14+
18255 -- Apprentice Darius
15+
);
16+
17+
-- Hide the 11 cultists in Un'Goro (Bracket 70_4)
18+
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1` IN (28602, 28601) AND `guid` IN (209102,209103,209104,209105,209106,209107,209108,209109,209110,209111,209112);
19+
20+
-- Hide Emalon, Koralon and Toravon at Vault of Archavon
21+
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1` IN (
22+
33993, -- Emalon
23+
35013, -- Koralon
24+
38433 -- Toravon
25+
);
26+
27+
-- Hide World Bosses
28+
UPDATE `creature` SET `phasemask` = 16384 WHERE `id1` IN (
29+
6109, -- Azuregos
30+
12397, -- Lord Kazzak
31+
14890, -- Ysondre
32+
14889, -- Lethon
33+
14888, -- Emeriss
34+
14887, -- Taerar
35+
18728, -- Doom Lord Kazzak
36+
17711 -- Doomwalker
37+
);
38+
39+
-- Replace Kor'Kron Overseer with Undercity Guardian until ICC
40+
UPDATE `creature` SET `id1`=5624, `equipment_id`=0 WHERE `map`=0 AND `id1`=36213;

src/Bracket_0/sql/world/progression_0_creature_Gangrenous.sql

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/Bracket_0/sql/world/progression_0_creature_KarazhanNPCs.sql

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/Bracket_0/sql/world/progression_0_creature_UngoroCultists.sql

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/Bracket_0/sql/world/progression_0_creature_VaultofArchavon.sql

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/Bracket_0/sql/world/progression_0_creature_WorldBosses.sql

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Bracket_0/sql/world/progression_0_creature_undercity_guardian.sql

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
-- 61-64 level range - The Blood Furnace, Hellfire Ramparts, The Underbog, The Slave Pens, Mana Tombs
22
UPDATE `disables` SET `flags`=`flags`&~1 WHERE `entry` IN (542, 543, 546, 547, 557);
3+
4+
-- Disable BT attunement quest chain
5+
DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (10944);
6+
INSERT INTO `disables` (`sourceType`, `entry`, `comment`) VALUES
7+
(1, 10944, 'The Secret Compromised');

src/Bracket_61_64/sql/world/progression_61_64_disables_quest_BT_attunement.sql

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)