tools/dbtool.py is the primary database management utility. It handles initial database setup, incremental updates, data migrations, backups, and several maintenance tasks.
Prerequisites
mariadb, gitpython, pyyaml, colorama, zmq.
The tool also requires mysql (or mariadb) CLI tools to be available on PATH, or configured via tools/config.yaml.
Command-line reference
- update
- migrate
- backup
- setup
- dump
Update the database to match the current repository state.What it does:
- Optionally creates a backup (controlled by
auto_backupinconfig.yaml) - Imports any missing protected tables (first-time setup only)
- Imports all changed
.sqlfiles fromsql/ - Runs any pending data migrations
- Updates the version hash stored in
config.yaml
Protected tables (player data: characters, accounts, inventory, etc.) are never overwritten by an update. Only missing protected tables are imported on first run.
Interactive menu
Runningpython tools/dbtool.py without arguments opens an interactive menu:
Maintenance Tasks submenu
Accessible viat from the main menu:
config.yaml
Dbtool stores its own configuration intools/config.yaml. This file is created automatically on first run.
Environment variable overrides
Database credentials fromsettings/network.lua can be overridden with environment variables:
Running inside Docker
Thedev.docker-compose.yml includes a setup_database service that runs dbtool inside the container:
Launch server from dbtool
The interactive menu’sl option launches all four server processes using zone IP and port settings read from the zone_settings database table: