@@ -0,0 +1,32 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "footage_plates" (
|
||||
"id" TEXT NOT NULL,
|
||||
"shotId" TEXT NOT NULL,
|
||||
"label" TEXT NOT NULL DEFAULT '',
|
||||
"fileUrl" TEXT NOT NULL,
|
||||
"fileKey" TEXT NOT NULL DEFAULT '',
|
||||
"fileName" TEXT NOT NULL DEFAULT '',
|
||||
"fileSize" BIGINT,
|
||||
"sortOrder" INTEGER NOT NULL DEFAULT 0,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "footage_plates_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "footage_plates" ADD CONSTRAINT "footage_plates_shotId_fkey" FOREIGN KEY ("shotId") REFERENCES "shots"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- Migrate existing single-footage data into footage_plates
|
||||
INSERT INTO "footage_plates" ("id", "shotId", "label", "fileUrl", "fileKey", "fileName", "fileSize", "sortOrder", "createdAt")
|
||||
SELECT
|
||||
gen_random_uuid()::text,
|
||||
id,
|
||||
'Plate A',
|
||||
"originalFootageUrl",
|
||||
COALESCE("originalFootageKey", ''),
|
||||
'',
|
||||
NULL,
|
||||
0,
|
||||
NOW()
|
||||
FROM "shots"
|
||||
WHERE "originalFootageUrl" IS NOT NULL AND "originalFootageUrl" != '';
|
||||
@@ -279,11 +279,28 @@ model Shot {
|
||||
shotGroup ShotGroup? @relation(fields: [shotGroupId], references: [id])
|
||||
versions Version[]
|
||||
tasks Task[]
|
||||
footagePlates FootagePlate[]
|
||||
|
||||
@@unique([projectId, shotCode])
|
||||
@@map("shots")
|
||||
}
|
||||
|
||||
model FootagePlate {
|
||||
id String @id @default(cuid())
|
||||
shotId String
|
||||
label String @default("")
|
||||
fileUrl String
|
||||
fileKey String @default("")
|
||||
fileName String @default("")
|
||||
fileSize BigInt?
|
||||
sortOrder Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
shot Shot @relation(fields: [shotId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("footage_plates")
|
||||
}
|
||||
|
||||
model ShotGroup {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
|
||||
Reference in New Issue
Block a user