wulf-pulse/migrations/046_create_teams_meetings_table.sql
lorentz c518eefdb2 feat: Morning NOC Summary adaptive card for Teams
- Add MorningSummaryService with Zabbix aggregation and adaptive card builder
- Add webhook delivery system with Teams incoming webhooks
- Add admin UI at /admin/morning-summary for webhook/config management
- Add API routes: /send, /test, /webhooks, /webhooks/[id], /config, /history
- Register morning-summary cron job in SyncScheduler (Mon-Fri 6:30 AM)
- Add outages_only filter (Unavailable triggers only)
- Fix host resolution: use getTriggerEnabledHosts to exclude disabled hosts
- Fix resolved events: event.get value:1 scoped to window with r_eventid filter
- Remove emojis from fact rows and section headers in card
- Remove Open Zabbix button (duplicate of View Problems)
- Add migrations: morning_summary_config + morning_summaries tables
- Add outages_only column to morning_summary_config
2026-03-11 09:34:51 -04:00

28 lines
1 KiB
SQL

CREATE TABLE IF NOT EXISTS teams_meetings (
id SERIAL PRIMARY KEY,
graph_event_id VARCHAR(500) NOT NULL,
user_email VARCHAR(255) NOT NULL,
subject VARCHAR(500),
start_time TIMESTAMPTZ,
end_time TIMESTAMPTZ,
duration_minutes INTEGER,
is_online_meeting BOOLEAN DEFAULT false,
attendee_count INTEGER DEFAULT 0,
client_attendee_count INTEGER DEFAULT 0,
has_client_attendees BOOLEAN DEFAULT false,
synced_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE(user_email, graph_event_id)
);
CREATE TABLE IF NOT EXISTS teams_meeting_attendees (
id SERIAL PRIMARY KEY,
meeting_id INTEGER NOT NULL REFERENCES teams_meetings(id) ON DELETE CASCADE,
attendee_email VARCHAR(255),
attendee_name VARCHAR(255),
matched_contact_id BIGINT REFERENCES contacts(id),
matched_company_id BIGINT REFERENCES companies(id),
created_at TIMESTAMPTZ DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_teams_meetings_user_email_time ON teams_meetings(user_email, start_time);
CREATE INDEX IF NOT EXISTS idx_teams_meeting_attendees_meeting_id ON teams_meeting_attendees(meeting_id);