← back to Ventura Claw Leads

db/migrations/006_lead_read_state.sql

10 lines

-- Lead read/unread state for the admin inbox. Businesses click "Mark as read"
-- after they've followed up; the dashboard surfaces the unread count so they
-- can triage. read_at NULL = unhandled; non-null = handled (with timestamp).

ALTER TABLE business_interest
  ADD COLUMN IF NOT EXISTS read_at TIMESTAMPTZ;

CREATE INDEX IF NOT EXISTS business_interest_unread_idx
  ON business_interest (business_id) WHERE read_at IS NULL;