📦 Database Schema
Monitron SaaS uses 14 migration files creating 20+ tables. Here's the complete schema reference.
📊 Core Tables
users
| Column | Type | Description |
|---|---|---|
| id | bigint PK | |
| name | string | Display name |
| string (unique) | Login email | |
| password | string | Hashed password |
| avatar_url | string (nullable) | Profile picture URL |
| timezone | string | User's timezone |
| locale | string | Language preference |
| two_factor_secret | text (nullable) | 2FA secret |
| is_admin | boolean | Super admin flag |
| current_team_id | FK → teams | Active team |
teams
| Column | Type | Description |
|---|---|---|
| id | bigint PK | |
| name | string | Team name |
| slug | string (unique) | URL-friendly identifier |
| owner_id | FK → users | Team owner |
| settings | json (nullable) | Team-specific settings |
team_user (pivot)
| Column | Type |
|---|---|
| team_id | FK → teams |
| user_id | FK → users |
| role | string (owner/admin/member) |
📡 Monitoring Tables
monitors
| Column | Type | Description |
|---|---|---|
| id | bigint PK | |
| team_id | FK → teams | Owning team |
| name | string | Display name |
| type | string (enum) | Monitor type |
| address | string | URL, hostname, or IP |
| port | int (nullable) | Port number |
| interval_seconds | int | Check frequency |
| timeout_seconds | int | Max wait time |
| config | json (nullable) | Type-specific configuration |
| is_active | boolean | Active flag |
| is_paused | boolean | Manually paused |
| status | string (enum) | Current status |
| last_response_time_ms | int (nullable) | Latest response time |
| last_checked_at | datetime (nullable) | Last check timestamp |
| last_up_at / last_down_at | datetime (nullable) | Last status change |
| consecutive_failures | int | Failure counter |
| uptime_percentage | decimal(7,3) | 30-day uptime |
| heartbeat_token | string (nullable) | Unique heartbeat URL token |
| tags | json (nullable) | Categorization tags |
| notes | text (nullable) | User notes |
monitor_checks
High-volume table — stores every check result:
| Column | Type | Description |
|---|---|---|
| id | bigint PK | |
| monitor_id | FK → monitors | |
| status | string | Check result status |
| response_time_ms | int (nullable) | Response time |
| status_code | int (nullable) | HTTP status code |
| error_message | text (nullable) | Error details |
| metadata | json (nullable) | Extra data (headers, cert info, etc.) |
| checked_at | datetime | When the check ran |
Indexes: (monitor_id, checked_at) for fast time-range queries.
🔥 Incident Tables
incidents
| Column | Type | Description |
|---|---|---|
| id | bigint PK | |
| team_id | FK → teams | |
| monitor_id | FK → monitors (nullable) | Related monitor |
| title | string | Incident title |
| severity | string (enum) | Info/Warning/Critical/Emergency |
| status | string (enum) | Investigating/Identified/Monitoring/Resolved |
| description | text (nullable) | Details |
| started_at | datetime | When it started |
| acknowledged_at | datetime (nullable) | When acknowledged |
| acknowledged_by | FK → users (nullable) | Who acknowledged |
| resolved_at | datetime (nullable) | When resolved |
| resolved_by | FK → users (nullable) | Who resolved |
incident_updates
Timeline entries for incidents.
🔔 Notification Tables
alert_rules, contacts, contact_groups, notification_logs
Alert routing, contact management, and delivery logging.
📊 Other Tables
status_pages, status_page_components, status_page_subscribers
Public status page configuration and subscribers.
server_agents, server_metrics
Server monitoring agent data.
certificates, domains
SSL certificate and domain WHOIS data.
maintenance_windows, audit_logs, app_settings
Scheduled maintenance, audit trail, and dynamic configuration.