CREATE TABLE IF NOT EXISTS gateway_route_probe_leases (
  pool_id text NOT NULL REFERENCES gateway_execution_pools(pool_id) ON DELETE CASCADE,
  route_profile_key text NOT NULL,
  lease_token uuid NOT NULL,
  expires_at timestamptz NOT NULL,
  updated_at timestamptz NOT NULL DEFAULT now(),
  PRIMARY KEY (pool_id, route_profile_key)
);

CREATE INDEX IF NOT EXISTS idx_gateway_route_probe_leases_expiry
  ON gateway_route_probe_leases(expires_at);
