fix: OnDelete SetNull for watchlist delete on watchlistAudit (#25690)

* OnDelete SetNull for watchlist delete on watchlistAudit

* make watchlistId nullable

* type fix
This commit is contained in:
Syed Ali Shahbaz authored and GitHub committed 2025-12-08 05:22:01 +00:00
1 parent 9631d0a64b
commit c78552ce60
4 files changed
+12 -4

No files matched your search

@@ -0,0 +1,8 @@
-- DropForeignKey
ALTER TABLE "public"."WatchlistAudit" DROP CONSTRAINT "WatchlistAudit_watchlistId_fkey";
-- AlterTable
ALTER TABLE "public"."WatchlistAudit" ALTER COLUMN "watchlistId" DROP NOT NULL;
-- AddForeignKey
ALTER TABLE "public"."WatchlistAudit" ADD CONSTRAINT "WatchlistAudit_watchlistId_fkey" FOREIGN KEY ("watchlistId") REFERENCES "public"."Watchlist"("id") ON DELETE SET NULL ON UPDATE CASCADE;
+2 -2
View File
@@ -2382,8 +2382,8 @@ model WatchlistAudit {
changedAt DateTime @default(now())
changedByUserId Int?
watchlistId String @db.Uuid
watchlist Watchlist? @relation(fields: [watchlistId], references: [id], onDelete: Cascade)
watchlistId String? @db.Uuid
watchlist Watchlist? @relation(fields: [watchlistId], references: [id], onDelete: SetNull)
@@index([watchlistId, changedAt])
}