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
- _tab_problems: 750 queries → ~10 batch queries with GROUP BY - _tab_engagement: 2550 queries → ~12 batch queries, sparkline in 1 query - user_insights_profile: 60+ queries → batch trend (2 queries), bot filtering on all metrics - Stat cards exclude UNAFFILIATED, dormant excludes never-logged-in users - Engagement status: never-logged=dormant, login<=7d+score>=10=active, 8-30d=at_risk - Badge CSS: support both at-risk and at_risk class names - Problems table: added Alerts and Locked columns - Security alerts stat card in Problems tab - Back link preserves tab/period context - Trend chart Y-axis dynamic instead of hardcoded max:30 - Timeline truncation info when >= 150 events - Migration 080: composite indexes on audit_logs and email_logs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
15 lines
654 B
SQL
15 lines
654 B
SQL
-- Migration 080: Performance indexes for User Insights dashboard
|
|
-- Addresses slow queries in _tab_problems and _tab_engagement
|
|
|
|
-- audit_logs: user_email + action + created_at (problem score, failed logins)
|
|
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_al_email_action_date
|
|
ON audit_logs(user_email, action, created_at DESC);
|
|
|
|
-- email_logs: recipient_email + email_type + created_at (password resets)
|
|
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_el_recipient_type_date
|
|
ON email_logs(recipient_email, email_type, created_at DESC);
|
|
|
|
-- Grant permissions
|
|
GRANT ALL ON TABLE audit_logs TO nordabiz_app;
|
|
GRANT ALL ON TABLE email_logs TO nordabiz_app;
|