Database Schema

Kiba Bot uses SQLite with WAL journaling and foreign keys enabled. The database file is stored at the path specified by DATABASE_PATH (default: /app/data/kiba.db).

users

ColumnTypeDefaultDescription
discord_idTEXT (PK)-Discord user snowflake ID
codeTEXT (UNIQUE)-4-char alphanumeric code
roblox_usernameTEXTNULLBound Roblox username
roblox_user_idTEXTNULLBound Roblox numeric user ID
is_bannedINTEGER00 = active, 1 = banned
ban_reasonTEXTNULLReason for ban
is_pausedINTEGER00 = active, 1 = paused
rebind_countINTEGER0Number of rebinds used (max 3)
is_invalidatedINTEGER00 = valid, 1 = invalidated
created_atTEXT-ISO 8601 timestamp of code creation
join_dateTEXT-ISO 8601 timestamp of Discord server join
last_snapshot_atTEXTNULLISO 8601 timestamp of last RPC read

code_history

ColumnTypeDescription
idINTEGER (PK)Auto-increment
discord_idTEXTDiscord user snowflake ID
codeTEXTThe code that was issued
issued_atTEXTISO 8601 timestamp

/rotate prunes this table to the last 5 entries per discord_id.

action_log

ColumnTypeDescription
idINTEGER (PK)Auto-increment
discord_idTEXTDiscord user snowflake ID
actionTEXTAction type: rebind, rotate, ban, unban, delete, invalidated
detailsTEXTHuman-readable description
performed_byTEXTDiscord ID of the operator, or "system"
timestampTEXTISO 8601 timestamp

infractions

Stores trusted safety event records tied to a linked user when the game server sends a code with the event.

ColumnTypeDescription
idINTEGER (PK)Auto-increment
discord_idTEXTDiscord user snowflake ID
roblox_user_idTEXTRoblox user ID
infraction_typeTEXTSafety event type label
descriptionTEXTDescription of the event
issued_byTEXTSource that issued the event
timestampTEXTISO 8601 timestamp

webhook_config

ColumnTypeDescription
idINTEGER (PK)Auto-increment
categoryTEXT (UNIQUE)Private event route key
webhook_urlTEXTPrivate Discord webhook URL
set_byTEXTDiscord ID of the operator
set_atTEXTISO 8601 timestamp

server_config

ColumnTypeDescription
server_idTEXT (PK)Discord guild snowflake ID
is_whitelistedINTEGER0 = not whitelisted, 1 = whitelisted
whitelisted_byTEXTDiscord ID of the operator
whitelisted_atTEXTISO 8601 timestamp

channel_config

ColumnTypeDescription
idINTEGER (PK)Auto-increment
guild_idTEXTDiscord guild snowflake ID
channel_idTEXT (UNIQUE)Discord channel snowflake ID
is_allowedINTEGER0 = disallowed, 1 = allowed
set_byTEXTDiscord ID of the operator
set_atTEXTISO 8601 timestamp