.sql files that are applied to the database when you run dbtool update. They can insert new records, update existing data, or delete rows — anything you can express in SQL.
Common uses:
- Adjusting mob drop tables (add, remove, or reweight drops)
- Relocating dangerous mob spawn points
- Inserting custom NPC records
- Modifying item stats or availability
- Changing quest or ability data stored in the database
How SQL modules work
Whendbtool update runs, it applies any .sql files that are listed (directly or via their parent folder) in modules/init.txt. The files are executed in the order they are listed.
SQL modules run against the live database, so they must be written to be idempotent — safe to apply more than once.
Always write SQL modules so they can be re-run without causing errors or corrupting data. Use
INSERT IGNORE, ON DUPLICATE KEY UPDATE, or WHERE clauses that target specific rows rather than bulk operations without guards.Creating a SQL module
Create your SQL file
Place the file in Use
modules/custom/sql/ (or any subfolder of modules/).modules/custom/sql/safe_outposts.sql
WHERE clauses that match the exact current position or values, so the update is a no-op if already applied.Idempotency patterns
SQL modules may be applied every timedbtool update runs. Use these patterns to prevent duplicate inserts or errors on re-run.
Example: removing mob drops
The era accuracy modules inmodules/toau/sql/ show a real pattern for removing items from the drop table:
modules/toau/sql/mob_droplist_removal.sql
DELETE statements are not idempotent in the strict sense — a second run is a no-op only because the row is already gone. They are safe to re-run as long as you do not need the data restored between runs.Example: enabling a custom NPC
modules/custom/sql/lsb_mascot.sql
Common tables
| Table | What to modify |
|---|---|
mob_droplist | Mob drop items and rates |
mob_spawn_points | Mob spawn coordinates |
npc_list | NPC records, names, and flags |
item_basic | Item base stats |
item_equipment | Equipment slot and level data |
abilities | Job ability properties |
spell_list | Spell availability by job |