CREATE TABLE IF NOT EXISTS "image_derivative_jobs" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "inventory_image_id" uuid NOT NULL REFERENCES "inventory_images"("id"), "source_key" text NOT NULL, "status" text DEFAULT 'PENDING' NOT NULL, "derivatives" jsonb DEFAULT '[]'::jsonb NOT NULL, "error" text, "created_at" timestamp with time zone DEFAULT now() NOT NULL, "updated_at" timestamp with time zone DEFAULT now() NOT NULL ); CREATE INDEX IF NOT EXISTS "image_derivative_jobs_image_id_index" ON "image_derivative_jobs" ("inventory_image_id");