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:
@@ -22,7 +22,7 @@ export interface WatchlistAudit {
|
||||
action: WatchlistAction;
|
||||
changedAt: Date;
|
||||
changedByUserId?: number | null;
|
||||
watchlistId: string;
|
||||
watchlistId: string | null;
|
||||
}
|
||||
|
||||
export interface WatchlistEventAudit {
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface WatchlistEntry {
|
||||
|
||||
export interface WatchlistAuditEntry {
|
||||
id: string;
|
||||
watchlistId: string;
|
||||
watchlistId: string | null;
|
||||
type: WatchlistType;
|
||||
value: string;
|
||||
description: string | null;
|
||||
|
||||
+8
@@ -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;
|
||||
@@ -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])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user