Skip to content

Database

Florianpal1 edited this page Aug 6, 2026 · 1 revision

Database

Only the proxy module talks to the database. Backend servers hold no state.

Connection settings live in database.yml — see Proxy Configuration.


Setup

  1. Create a database (schema) and a user:
CREATE DATABASE fmessage DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'fmessage'@'%' IDENTIFIED BY 'a-strong-password';
GRANT ALL PRIVILEGES ON fmessage.* TO 'fmessage'@'%';
FLUSH PRIVILEGES;
  1. Point database.yml at it (remember: jdbc:mariadb://…).
  2. Start the proxy. FMessage checks for each of its tables and creates the missing ones with CREATE TABLE IF NOT EXISTS.

The user needs CREATE, SELECT, INSERT, UPDATE and DELETE on that schema.


Schema

Four tables, all prefixed fm_. The prefix is not configurable.

fm_groups

One row per discussion group.

Column Type Description
id INTEGER AUTO_INCREMENT Primary key, referenced by fm_groupMembers.id_group
playerOwnerUuid VARCHAR(36) UUID of the player who created the group
name VARCHAR(36) Group name

PRIMARY KEY (id) — group names are not unique at the database level; uniqueness is only enforced per owner by the /group create command.

fm_groupMembers

Membership, and the chat toggle.

Column Type Description
id_group INTEGER Group id
playerMemberUuid VARCHAR(36) UUID of the member
toggle BIT 1 when this member redirects their public chat into this group

PRIMARY KEY (id_group, playerMemberUuid). There is no foreign key: deleting a group also deletes its rows here through the /group remove command.

fm_ignores

Column Type Description
playerSenderUuid VARCHAR(36) UUID of the player who ignores
playerTargetUuid VARCHAR(36) UUID of the ignored player

PRIMARY KEY (playerSenderUuid, playerTargetUuid). The relation is one-way, but FMessage blocks messages in both directions as soon as one row exists.

fm_nickname

Column Type Description
uuid VARCHAR(36) Player UUID
nickname VARCHAR(200) Nickname, colour codes included

PRIMARY KEY (uuid) — one nickname per player. Removing a nickname (/nick with no argument) deletes the row.

All tables are created with DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci.


Caching

Groups, members and ignores are loaded into memory at proxy startup and refreshed after each command that changes them. Nicknames are read through a cache as well. Consequences:

  • Editing the tables by hand while the proxy is running has no immediate effect — restart the proxy.
  • Running two proxies against the same database is not supported: each keeps its own cache and they will drift apart.

Maintenance

Reset everything without reinstalling:

TRUNCATE TABLE fm_groupMembers;
TRUNCATE TABLE fm_groups;
TRUNCATE TABLE fm_ignores;
TRUNCATE TABLE fm_nickname;

Uninstalling FMessage leaves the tables in place — drop them manually if you want them gone.

Clone this wiki locally