Files
rust-discovery/migrations/0032_approval_inbox.sql
T

8 lines
413 B
SQL

-- Count and page pending requests by customer without walking decided requests.
CREATE INDEX approval_requests_pending_inbox ON approval_requests
(tenant_id, created_at DESC, operation_id DESC) INCLUDE (plan_id)
WHERE approval_state = 'pending_approval';
CREATE INDEX approval_requests_timeline ON approval_requests
(tenant_id, created_at DESC, operation_id DESC) INCLUDE (plan_id, approval_state);