Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
New admin dashboard at /admin/user-insights providing: - Problem detection tab (problem scoring, locked accounts, failed logins) - Engagement ranking tab (engagement scoring, WoW comparison, sparklines) - Page map tab (section heatmap, top 50 pages, unused pages) - Paths tab (entry/exit pages, transitions, drop-off analysis) - Overview tab (Chart.js charts, hourly heatmap, device breakdown) - Individual user drill-down profiles with timelines and gauges Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
31 lines
1.5 KiB
SQL
31 lines
1.5 KiB
SQL
-- Migration 078: User Insights Dashboard - Performance Indexes
|
|
-- Created: 2026-02-21
|
|
-- Purpose: Optimize queries for user insights dashboard (problem scoring, engagement, page map, paths)
|
|
|
|
-- Page views: user + date for engagement queries
|
|
CREATE INDEX IF NOT EXISTS idx_pv_user_date ON page_views(user_id, viewed_at DESC);
|
|
|
|
-- Page views: session + date for path analysis (entry/exit pages, transitions)
|
|
CREATE INDEX IF NOT EXISTS idx_pv_session_date ON page_views(session_id, viewed_at);
|
|
|
|
-- Page views: path + date for page map (partial index for recent data)
|
|
CREATE INDEX IF NOT EXISTS idx_pv_path_date ON page_views(path, viewed_at) WHERE viewed_at >= '2026-01-01';
|
|
|
|
-- Email logs: user + type for password reset tracking
|
|
CREATE INDEX IF NOT EXISTS idx_el_user_type ON email_logs(user_id, email_type, created_at DESC);
|
|
|
|
-- JS errors: session for joining with user sessions
|
|
CREATE INDEX IF NOT EXISTS idx_je_session ON js_errors(session_id, occurred_at DESC);
|
|
|
|
-- Security alerts: email + date for problem scoring
|
|
CREATE INDEX IF NOT EXISTS idx_sa_email_date ON security_alerts(user_email, created_at DESC);
|
|
|
|
-- User sessions: user + date for engagement/session queries
|
|
CREATE INDEX IF NOT EXISTS idx_us_user_date ON user_sessions(user_id, started_at DESC);
|
|
|
|
-- Search queries: user + date for engagement scoring
|
|
CREATE INDEX IF NOT EXISTS idx_sq_user_date ON search_queries(user_id, searched_at DESC);
|
|
|
|
-- Conversion events: user + date for engagement scoring
|
|
CREATE INDEX IF NOT EXISTS idx_ce_user_date ON conversion_events(user_id, converted_at DESC);
|