D1 Schema
All tables are managed by the migration system in setup.js (v1–v10). Run POST /api/setup to apply pending migrations.
All Tables
Section titled “All Tables”| Table | Created in | Purpose |
|---|---|---|
chat_messages | v1 | AI conversation history (per-user) |
access_roles | v1 | Role definitions (admin, operator, viewer, etc.) |
access_users | v1 | User profiles (email, role_id, overrides, first/last name, onboarded) |
access_role_permissions | v2 | Normalized permissions per role (role_id, permission, granted) |
schema_migrations | v3 | Migration version tracking |
activity_logs | v4 | Audit trail (user actions, page views) |
infra_config | v5 | Infrastructure configuration (links, endpoints, keys) |
sites | v6 | Sites (code, name, country, city, timezone, RPIs, APIs) |
teams | v7 | Team definitions (name, description, default_role_id) |
team_members | v7 | Team membership (team_id, email) |
team_sites | v7 | Site assignments per team |
trigger_settings | v8 | Alert threshold configurations with severity |
rpi_snapshots | Cron | Periodic RPi status snapshots |
rpi_alerts_history | Cron | Historical RPi alerts |
trigger_alerts | Cron | Active server-evaluated alerts |
receipt_api_health | Cron | Receipt API health snapshots |
receipt_api_requests | Cron | Receipt processing metrics |
team_requests | v10 | Team join requests (pending/approved/denied) |