@@ -0,0 +1,54 @@
|
||||
-- Two-stage review gate migration
|
||||
-- Replaces IN_REVIEW with INTERNAL_REVIEW, adds READY_FOR_CLIENT and CLIENT_REVIEW,
|
||||
-- adds ShotApprovalStatus enum, and adds shotApprovalStatus + sharedWithClient to shots.
|
||||
|
||||
-- ── 1. Recreate ShotStatus enum with new values ───────────────────────────────
|
||||
|
||||
-- Create replacement enum
|
||||
CREATE TYPE "ShotStatus_new" AS ENUM (
|
||||
'WAITING',
|
||||
'IN_PROGRESS',
|
||||
'INTERNAL_REVIEW',
|
||||
'READY_FOR_CLIENT',
|
||||
'CLIENT_REVIEW',
|
||||
'REVISIONS',
|
||||
'COMPLETE'
|
||||
);
|
||||
|
||||
-- Migrate shots table: IN_REVIEW → INTERNAL_REVIEW
|
||||
ALTER TABLE "shots"
|
||||
ALTER COLUMN "status" TYPE "ShotStatus_new"
|
||||
USING (
|
||||
CASE "status"::text
|
||||
WHEN 'IN_REVIEW' THEN 'INTERNAL_REVIEW'::"ShotStatus_new"
|
||||
ELSE "status"::text::"ShotStatus_new"
|
||||
END
|
||||
);
|
||||
|
||||
-- Migrate assets table: IN_REVIEW → INTERNAL_REVIEW
|
||||
ALTER TABLE "assets"
|
||||
ALTER COLUMN "status" TYPE "ShotStatus_new"
|
||||
USING (
|
||||
CASE "status"::text
|
||||
WHEN 'IN_REVIEW' THEN 'INTERNAL_REVIEW'::"ShotStatus_new"
|
||||
ELSE "status"::text::"ShotStatus_new"
|
||||
END
|
||||
);
|
||||
|
||||
-- Drop old enum and rename new one
|
||||
DROP TYPE "ShotStatus";
|
||||
ALTER TYPE "ShotStatus_new" RENAME TO "ShotStatus";
|
||||
|
||||
-- ── 2. Create ShotApprovalStatus enum ────────────────────────────────────────
|
||||
|
||||
CREATE TYPE "ShotApprovalStatus" AS ENUM (
|
||||
'PENDING',
|
||||
'INTERNALLY_APPROVED',
|
||||
'CLIENT_APPROVED'
|
||||
);
|
||||
|
||||
-- ── 3. Add new columns to shots ───────────────────────────────────────────────
|
||||
|
||||
ALTER TABLE "shots"
|
||||
ADD COLUMN "shotApprovalStatus" "ShotApprovalStatus" NOT NULL DEFAULT 'PENDING',
|
||||
ADD COLUMN "sharedWithClient" BOOLEAN NOT NULL DEFAULT false;
|
||||
+11
-1
@@ -33,11 +33,19 @@ enum ProjectStatus {
|
||||
enum ShotStatus {
|
||||
WAITING
|
||||
IN_PROGRESS
|
||||
IN_REVIEW
|
||||
INTERNAL_REVIEW
|
||||
READY_FOR_CLIENT
|
||||
CLIENT_REVIEW
|
||||
REVISIONS
|
||||
COMPLETE
|
||||
}
|
||||
|
||||
enum ShotApprovalStatus {
|
||||
PENDING
|
||||
INTERNALLY_APPROVED
|
||||
CLIENT_APPROVED
|
||||
}
|
||||
|
||||
enum ShotPriority {
|
||||
LOW
|
||||
NORMAL
|
||||
@@ -287,6 +295,8 @@ model Shot {
|
||||
originalFootageUrl String?
|
||||
originalFootageKey String?
|
||||
shotGroupId String?
|
||||
shotApprovalStatus ShotApprovalStatus @default(PENDING)
|
||||
sharedWithClient Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
|
||||
+2
-2
@@ -123,14 +123,14 @@ async function main() {
|
||||
shotCode: "SH010",
|
||||
sequence: "010",
|
||||
description: "Wide establishing shot of the space station exterior.",
|
||||
status: ShotStatus.IN_REVIEW,
|
||||
status: ShotStatus.INTERNAL_REVIEW,
|
||||
priority: ShotPriority.HIGH,
|
||||
},
|
||||
{
|
||||
shotCode: "SH020",
|
||||
sequence: "010",
|
||||
description: "Close-up of astronaut helmet reflection.",
|
||||
status: ShotStatus.IN_REVIEW,
|
||||
status: ShotStatus.INTERNAL_REVIEW,
|
||||
priority: ShotPriority.HIGH,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user