Database

Configure storage for sell history records.

Choosing a Backend

Pick based on your setup:

SQLite

File-based, zero config. Default. Best for single servers — no external database needed.

MySQL / MariaDB

Remote database. Use this if you run a network of servers and want shared history, or need external tools (dashboards, scripts) to query sell data.

Not sure? Use SQLite. You can always switch later — just be aware that history data is not migrated when changing backends.

SQLite

database.yml
data-storage-method: SQLite

SQLite:
  file: 'TheBrewingMarket'
  table-prefix: 'tbm'

MySQL

database.yml
data-storage-method: MySQL

MySQL:
  host: 'localhost'
  port: '3306'
  user: 'root'
  password: 'password'
  database: 'minecraft'
  connection-parameters: '?useSSL=false&useUnicode=true&characterEncoding=UTF-8'
  table-prefix: 'tbm'
  Pool-Settings:
    max-pool-size: 10
    min-idle: 10
    max-lifetime: 180000
    keep-alive-time: 60000
    time-out: 20000

Pool Settings

KeyDefaultDescription
max-pool-size10Max connections
min-idle10Min idle connections
max-lifetime180000Max connection lifetime (ms)
keep-alive-time60000Keep-alive interval (ms)
time-out20000Connection timeout (ms)

MariaDB

Same structure as MySQL. Just change the storage method:

database.yml
data-storage-method: MariaDB

Table Schema

TheBrewingMarket creates {prefix}_sell_history with:

ColumnType (MySQL)Description
idBIGINTAuto-increment PK
player_uuidVARCHAR(36)Player UUID
player_nameVARCHAR(32)Player name
recipe_idTEXTRecipe identifier
display_nameTEXTBrew display name (nullable)
qualityDOUBLEQuality score
price_perDOUBLEPrice per unit
quantityINTItems sold
totalDOUBLETotal amount
sold_atBIGINTTimestamp (epoch ms)
SQLite: Uses TEXT, REAL, and INTEGER equivalents instead of the MySQL types shown above.

Schema Migrations

TheBrewingMarket automatically migrates the database schema on startup. You do not need to run any SQL manually — existing data is always preserved.

VersionChange
v0 → v1Column recipe_name renamed to recipe_id. Separate indexes replaced with a single composite index on (player_uuid, sold_at DESC).
Upgrading from an older version? Just restart the server — the migration runs automatically and your history data stays intact.
Note: Switching storage method does not migrate data between backends.