This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "shot_groups" (
|
||||
"id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"projectId" TEXT NOT NULL,
|
||||
"sortOrder" INTEGER NOT NULL DEFAULT 0,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "shot_groups_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "shots" ADD COLUMN "shotGroupId" TEXT;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "shot_groups_projectId_name_key" ON "shot_groups"("projectId", "name");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "shot_groups" ADD CONSTRAINT "shot_groups_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "shots" ADD CONSTRAINT "shots_shotGroupId_fkey" FOREIGN KEY ("shotGroupId") REFERENCES "shot_groups"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
+21
-4
@@ -245,6 +245,7 @@ model Project {
|
||||
shots Shot[]
|
||||
assets Asset[]
|
||||
tasks Task[]
|
||||
shotGroups ShotGroup[]
|
||||
reviewSessions ReviewSession[]
|
||||
|
||||
@@map("projects")
|
||||
@@ -269,18 +270,34 @@ model Shot {
|
||||
thumbnailUrl String?
|
||||
originalFootageUrl String?
|
||||
originalFootageKey String?
|
||||
shotGroupId String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
||||
artist User? @relation("ArtistShots", fields: [artistId], references: [id])
|
||||
versions Version[]
|
||||
tasks Task[]
|
||||
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
||||
artist User? @relation("ArtistShots", fields: [artistId], references: [id])
|
||||
shotGroup ShotGroup? @relation(fields: [shotGroupId], references: [id])
|
||||
versions Version[]
|
||||
tasks Task[]
|
||||
|
||||
@@unique([projectId, shotCode])
|
||||
@@map("shots")
|
||||
}
|
||||
|
||||
model ShotGroup {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
projectId String
|
||||
sortOrder Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
||||
shots Shot[]
|
||||
|
||||
@@unique([projectId, name])
|
||||
@@map("shot_groups")
|
||||
}
|
||||
|
||||
model Version {
|
||||
id String @id @default(cuid())
|
||||
versionNumber Int
|
||||
|
||||
Reference in New Issue
Block a user