Database Schema
Rug Radar uses Postgres for watchlists, snapshots, alerts, and tool-event logging.
The schema is defined in migrations/001_init.sql.
Tables
watchlists
Stores one active rule set per user_id and token_address.
Key fields:
user_idtoken_addressrules_jsonactive- timestamps
Important behavior:
watch_tokenupserts on(user_id, token_address)
token_snapshots
Stores token analysis snapshots over time.
Key fields:
token_addresssnapshot_jsonrisk_scoreliquiditytop10_pctfetched_at
Important behavior:
get_token_changesloads the latest snapshot and then inserts a new one
alerts
Stores triggered alert records tied to a watchlist.
Key fields:
watchlist_idtoken_addresstrigger_typetrigger_detaildedupe_keysent_at
Important behavior:
dedupe_keyis unique- Redis is used to reduce duplicate alert insertion attempts within the current dedupe window
tool_events
Stores tool usage events for observability and future analytics.
Key fields:
tool_nameuser_idtoken_addressmeta_jsoncreated_at
What Is Not Stored
- continuous market ticks
- full wallet histories outside current tool calls
- user auth records
- push-delivery state for alerts
Operational Implications
- if Postgres is unavailable, watch and change-tracking features will fail
- token and wallet analysis without persistence can still work