Skip to main content
tools/dbtool.py is the primary database management utility. It handles initial database setup, incremental updates, data migrations, backups, and several maintenance tasks.

Prerequisites

Required Python packages: 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 the database to match the current repository state.
What it does:
  1. Optionally creates a backup (controlled by auto_backup in config.yaml)
  2. Imports any missing protected tables (first-time setup only)
  3. Imports all changed .sql files from sql/
  4. Runs any pending data migrations
  5. 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

Running python tools/dbtool.py without arguments opens an interactive menu:

Maintenance Tasks submenu

Accessible via t from the main menu:

config.yaml

Dbtool stores its own configuration in tools/config.yaml. This file is created automatically on first run.

Environment variable overrides

Database credentials from settings/network.lua can be overridden with environment variables:

Running inside Docker

The dev.docker-compose.yml includes a setup_database service that runs dbtool inside the container:

Launch server from dbtool

The interactive menu’s l option launches all four server processes using zone IP and port settings read from the zone_settings database table:
Before launching a public server, use option 2 in the Maintenance Tasks menu (or dbtool.py directly) to set the correct external IP address in zone_settings.