drop index if exists public.idx_crm_queue_tenant_record_id;

create index if not exists idx_crm_queue_tenant_record_id_lookup
  on public.crm_webhook_queue(tenant_id, record_id, created_at desc)
  where record_id is not null;

create index if not exists idx_crm_queue_student_push
  on public.crm_webhook_queue(tenant_id, source, created_at desc)
  where source = 'tenant.student.crm_push';
