-- easyai:migration:no-transaction
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_gateway_tasks_runtime_owner
  ON gateway_tasks (locked_by, execution_lease_expires_at, id)
  WHERE status IN ('queued', 'running')
    AND execution_lease_expires_at IS NOT NULL;
