fix(schema): cascade-delete VideoConfig/LintResult/BulkJobItem/VideoPlaylist with their Video
Channel import crashed on the hard-delete purge path (videos confirmed gone from YouTube for 30+ days): prisma.video.deleteMany() hit a FK violation on VideoConfig_videoId_fkey. All four required relations pointing at Video had no onDelete behavior set, defaulting to RESTRICT - any of the four would have hit the same crash, not just VideoConfig. First real channel import against a real, aged dataset is what surfaced this; nothing had exercised the 30-day hard-delete path before.
This commit is contained in:
@@ -174,7 +174,7 @@ enum LintStatus {
|
||||
model VideoConfig {
|
||||
id String @id @default(cuid())
|
||||
videoId String @unique
|
||||
video Video @relation(fields: [videoId], references: [id])
|
||||
video Video @relation(fields: [videoId], references: [id], onDelete: Cascade)
|
||||
templateId String?
|
||||
blockOrder Json
|
||||
blockOverrides Json
|
||||
@@ -312,7 +312,7 @@ model SavedView {
|
||||
model LintResult {
|
||||
id String @id @default(cuid())
|
||||
videoId String
|
||||
video Video @relation(fields: [videoId], references: [id])
|
||||
video Video @relation(fields: [videoId], references: [id], onDelete: Cascade)
|
||||
ruleCode String
|
||||
severity LintSeverity
|
||||
targetField String?
|
||||
@@ -369,7 +369,7 @@ model BulkJobItem {
|
||||
bulkJobId String
|
||||
bulkJob BulkJob @relation(fields: [bulkJobId], references: [id])
|
||||
videoId String
|
||||
video Video @relation(fields: [videoId], references: [id])
|
||||
video Video @relation(fields: [videoId], references: [id], onDelete: Cascade)
|
||||
beforeSnapshot Json?
|
||||
afterSnapshot Json?
|
||||
status String @default("pending")
|
||||
@@ -415,7 +415,7 @@ model VideoPlaylist {
|
||||
videoId String
|
||||
playlistId String
|
||||
position Int?
|
||||
video Video @relation(fields: [videoId], references: [id])
|
||||
video Video @relation(fields: [videoId], references: [id], onDelete: Cascade)
|
||||
playlist Playlist @relation(fields: [playlistId], references: [id])
|
||||
|
||||
@@id([videoId, playlistId])
|
||||
|
||||
Reference in New Issue
Block a user