fix(growth): harden AI jobs and cost controls
This commit is contained in:
@@ -20,8 +20,12 @@ CREATE TABLE IF NOT EXISTS growth_reports (
|
||||
input_tokens bigint NOT NULL DEFAULT 0 CHECK (input_tokens >= 0),
|
||||
output_tokens bigint NOT NULL DEFAULT 0 CHECK (output_tokens >= 0),
|
||||
latency_ms bigint NOT NULL DEFAULT 0 CHECK (latency_ms >= 0),
|
||||
provider_requests bigint NOT NULL DEFAULT 0 CHECK (provider_requests >= 0),
|
||||
reserved_tokens bigint NOT NULL DEFAULT 0 CHECK (reserved_tokens >= 0),
|
||||
provider_request_id text,
|
||||
estimated_cost text,
|
||||
lease_token text,
|
||||
lease_expires_at timestamptz,
|
||||
manual_refresh boolean NOT NULL DEFAULT false,
|
||||
tehran_refresh_day date,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
@@ -33,6 +37,14 @@ ALTER TABLE growth_reports ADD COLUMN IF NOT EXISTS provider_request_id text;
|
||||
-- statement-break
|
||||
ALTER TABLE growth_reports ADD COLUMN IF NOT EXISTS estimated_cost text;
|
||||
-- statement-break
|
||||
ALTER TABLE growth_reports ADD COLUMN IF NOT EXISTS provider_requests bigint NOT NULL DEFAULT 0 CHECK (provider_requests >= 0);
|
||||
-- statement-break
|
||||
ALTER TABLE growth_reports ADD COLUMN IF NOT EXISTS reserved_tokens bigint NOT NULL DEFAULT 0 CHECK (reserved_tokens >= 0);
|
||||
-- statement-break
|
||||
ALTER TABLE growth_reports ADD COLUMN IF NOT EXISTS lease_token text;
|
||||
-- statement-break
|
||||
ALTER TABLE growth_reports ADD COLUMN IF NOT EXISTS lease_expires_at timestamptz;
|
||||
-- statement-break
|
||||
ALTER TABLE growth_reports ALTER COLUMN deterministic_evidence DROP NOT NULL;
|
||||
-- statement-break
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS growth_reports_current_fingerprint_idx
|
||||
|
||||
Reference in New Issue
Block a user