Repository Public
1-- Claude Code director runs: one idea in, one orchestrated film out.2CREATE TABLE director_runs (3 id uuid PRIMARY KEY DEFAULT gen_random_uuid(),4 project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,5 idea text NOT NULL,6 budget_usd numeric NOT NULL DEFAULT 15,7 status text NOT NULL DEFAULT 'queued' CHECK (status IN ('queued','running','done','failed','stopped')),8 stop_requested boolean NOT NULL DEFAULT false,9 log jsonb NOT NULL DEFAULT '[]',10 session_id text,11 agent_model text,12 agent_cost_usd numeric,13 turns int,14 report text,15 error text,16 created_by uuid REFERENCES users(id) ON DELETE SET NULL,17 created_at timestamptz NOT NULL DEFAULT now(),18 started_at timestamptz,19 finished_at timestamptz20);21CREATE INDEX director_runs_created ON director_runs(created_at DESC);22ALTER TABLE projects DROP CONSTRAINT projects_origin_check;23ALTER TABLE projects ADD CONSTRAINT projects_origin_check CHECK (origin IN ('studio','scheduler','api','director'));24