Skip to main content

Database Schema

TL;DR: Key tables you interact with when integrating or querying Resonance data.

Resonance uses Supabase (PostgreSQL) as its database layer. Tables are accessed via the Supabase client or REST API depending on your integration context.


Core Tables

discord_server_configs

Stores per-server configuration and links a Discord server to a brand.

server_id       TEXT PRIMARY KEY
brand_id TEXT NOT NULL
server_name TEXT
is_active BOOLEAN DEFAULT TRUE
config_metadata JSONB

discord_user_stats

Tracks cumulative engagement activity per user per server.

server_id          TEXT
discord_user_id TEXT
messages_count INTEGER
voice_minutes INTEGER
reactions_count INTEGER
reactions_received INTEGER -- NEW (migration 008): reactions received on the user's own messages
rsnc_earned BIGINT

Note: The reactions_received column was added in migration 008. If you are querying older data or a database that has not run this migration, this column may not be present.

discord_user_streaks

Tracks check-in streak data per user per server.

server_id        TEXT
discord_user_id TEXT
current_streak INTEGER
longest_streak INTEGER
last_checkin TIMESTAMPTZ

Event Configuration

monitoring_rules

Defines which events are tracked, how much RSNC they reward, and any rate-limiting constraints. This is the source of truth for event behavior — changes made via /config events in Discord sync with the Partner Portal.

id                  UUID PRIMARY KEY
brand_id TEXT NOT NULL
event_type TEXT NOT NULL
reward_amount NUMERIC
cooldown_hours INTEGER
max_claims_per_user INTEGER
is_enabled BOOLEAN DEFAULT TRUE
server_id TEXT

Drops

discord_drops

Represents a single drop instance created in a server channel. Drops can be button-based or reaction-based.

drop_id         UUID PRIMARY KEY
server_id TEXT NOT NULL
event_id TEXT NOT NULL
drop_type TEXT -- 'button' or 'reaction'
message_id TEXT
channel_id TEXT
emoji TEXT
expires_at TIMESTAMPTZ
max_claims INTEGER
claims_count INTEGER DEFAULT 0
created_by TEXT
created_at TIMESTAMPTZ DEFAULT NOW()

discord_drop_claims

Records individual user claims against a drop.

claim_id        UUID PRIMARY KEY
drop_id UUID NOT NULL
discord_user_id TEXT NOT NULL
claimed_at TIMESTAMPTZ DEFAULT NOW()
reward_amount NUMERIC