Skip to main content

Database setup

What tables TrapNexus creates, what lives in each, and how configuration and the database relate.

TrapNexus reaches the database through oxmysql. It needs no dedicated database of its own and can share the one your framework already uses.

Schema creation

Tables are created on first start if they do not exist, so no manual import is required. A schema file is also provided if you would rather apply it yourself, or need to review it before letting a resource create tables.

What is stored

Broadly, three kinds of thing:

Definitions — products, recipes, harvest zones, suppliers and market zones. These are seeded from config.lua the first time the resource starts, and after that the database is the source of truth. Editing them in the administration console writes here.

Player state — experience, rank, heat, streaks and totals, keyed by character identifier.

History — a row for every economy action, successful or rejected, with the reason and context attached, plus a separate record of every administrative change.

Configuration versus database

This catches people out, so it is worth stating plainly.

config.lua is a seed, not a live configuration file for the definitions it contains. Once a definition exists in the database, editing config.lua does not change it — the database value wins. Editing definitions is done in game through the administration console.

There is a setting that controls whether the seed is reapplied at start. Leaving it off is the right default for a live server: turning it on would overwrite tuning you have done in game every time the resource restarts.

Settings that are not database-backed, such as the security options, are read from config.lua on every start and do take effect after a restart.

Backups

Two of these tables hold things you cannot regenerate: your tuned definitions, and player progression. Back them up on the same schedule as the rest of your framework data.

The history table grows with activity. It is the thing that lets you answer a question about a transaction weeks later, so keep it — but it is also the first place to look if the database is growing faster than you expected.