Fix account delete blocked by CsvUpload FK constraint
Add onDelete: Cascade to CsvUpload.accountId so deleting an account cascades to its upload records. Also explicitly delete uploads before the account in the API route so existing deployed DBs without the constraint don't error. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -103,7 +103,7 @@ model BudgetRule {
|
||||
model CsvUpload {
|
||||
id String @id @default(cuid())
|
||||
accountId String
|
||||
account Account @relation(fields: [accountId], references: [id])
|
||||
account Account @relation(fields: [accountId], references: [id], onDelete: Cascade)
|
||||
fileName String
|
||||
rowCount Int
|
||||
importedCount Int
|
||||
|
||||
Reference in New Issue
Block a user