Files
dd0c/products/03-alert-intelligence/migrations/005_analytics.sql

14 lines
585 B
MySQL
Raw Normal View History

-- 005_analytics.sql
-- Migration for MTTR and Noise Reduction Analytics
-- Add resolved_at column for MTTR calculation (if not exists)
ALTER TABLE incidents ADD COLUMN IF NOT EXISTS resolved_at TIMESTAMPTZ;
-- Add pd_escalated_at column for PagerDuty auto-escalation idempotency
ALTER TABLE incidents ADD COLUMN IF NOT EXISTS pd_escalated_at TIMESTAMPTZ;
-- Add index on created_at for time-series queries (trends, noise stats)
CREATE INDEX IF NOT EXISTS idx_incidents_created_at ON incidents(created_at);
CREATE INDEX IF NOT EXISTS idx_alerts_received_at ON alerts(received_at);