fix: add cascade delete rules for tournament matches and related data
This commit is contained in:
@@ -148,7 +148,7 @@ model BracketMatchup {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
event Event @relation(fields: [eventId], references: [id])
|
||||
match Match? @relation(fields: [matchId], references: [id])
|
||||
match Match? @relation(fields: [matchId], references: [id], onDelete: Cascade)
|
||||
round TournamentRound @relation(fields: [roundId], references: [id])
|
||||
team1 Team? @relation("BracketTeam1", fields: [team1Id], references: [id])
|
||||
team2 Team? @relation("BracketTeam2", fields: [team2Id], references: [id])
|
||||
@@ -174,7 +174,7 @@ model Match {
|
||||
bracketMatchups BracketMatchup[]
|
||||
eloSnapshots EloSnapshot[]
|
||||
createdBy User? @relation("MatchCreator", fields: [createdById], references: [id])
|
||||
event Event? @relation(fields: [eventId], references: [id])
|
||||
event Event? @relation(fields: [eventId], references: [id], onDelete: Cascade)
|
||||
team1P1 Player @relation("MatchPlayer1", fields: [team1P1Id], references: [id])
|
||||
team1P2 Player @relation("MatchPlayer2", fields: [team1P2Id], references: [id])
|
||||
team2P1 Player @relation("MatchPlayer3", fields: [team2P1Id], references: [id])
|
||||
@@ -192,7 +192,7 @@ model EloSnapshot {
|
||||
ratingAfter Int
|
||||
ratingChange Int
|
||||
createdAt DateTime @default(now())
|
||||
match Match @relation(fields: [matchId], references: [id])
|
||||
match Match @relation(fields: [matchId], references: [id], onDelete: Cascade)
|
||||
player Player @relation(fields: [playerId], references: [id])
|
||||
|
||||
@@map("elo_snapshots")
|
||||
@@ -208,7 +208,7 @@ model PartnershipGame {
|
||||
player1EloChange Int?
|
||||
player2EloChange Int?
|
||||
createdAt DateTime @default(now())
|
||||
match Match @relation(fields: [matchId], references: [id])
|
||||
match Match @relation(fields: [matchId], references: [id], onDelete: Cascade)
|
||||
player1 Player @relation("PartnershipPlayer1", fields: [player1Id], references: [id])
|
||||
player2 Player @relation("PartnershipPlayer2", fields: [player2Id], references: [id])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user