-- Handles: frames rendered past the cut at each end of a shot. They ship with -- the EXRs but are not in the edit, so the review player flags them. Purely -- metadata — nothing renders differently. ALTER TABLE "versions" ADD COLUMN "handleHead" INTEGER; ALTER TABLE "versions" ADD COLUMN "handleTail" INTEGER; ALTER TABLE "versions" ADD COLUMN "pictureStartFrame" INTEGER; ALTER TABLE "exports" ADD COLUMN "handleHead" INTEGER; ALTER TABLE "exports" ADD COLUMN "handleTail" INTEGER; -- Backfill pipeline exports. Every render so far was queued by the panel with -- its Handle Frames setting (8 unless changed); the value is in the render -- manifest when the panel found a timing plate, otherwise use the house 8. UPDATE "exports" e SET "handleHead" = h.frames, "handleTail" = h.frames FROM ( SELECT e2."id", COALESCE( (SELECT (rj."manifest"->'source'->>'handleFrames')::int FROM "render_jobs" rj WHERE rj."exportId" = e2."id" AND rj."type" = 'AE_RENDER' AND jsonb_typeof(rj."manifest"->'source'->'handleFrames') = 'number' ORDER BY rj."createdAt" DESC LIMIT 1), 8 ) AS frames FROM "exports" e2 ) h WHERE h."id" = e."id"; -- ...and the preview Versions they produced. pictureStartFrame stays null: -- the player infers the head slate from the MP4 length vs the EXR frameCount. UPDATE "versions" v SET "handleHead" = e."handleHead", "handleTail" = e."handleTail" FROM "exports" e WHERE e."versionId" = v."id";