fix: make createdById at Watchlist nullable (#24033)

This commit is contained in:
Eunjae Lee
2025-09-24 07:55:27 -03:00
committed by GitHub
parent 8b75bf347f
commit 57150d992e
2 changed files with 10 additions and 2 deletions
@@ -0,0 +1,8 @@
-- DropForeignKey
ALTER TABLE "Watchlist" DROP CONSTRAINT "Watchlist_createdById_fkey";
-- AlterTable
ALTER TABLE "Watchlist" ALTER COLUMN "createdById" DROP NOT NULL;
-- AddForeignKey
ALTER TABLE "Watchlist" ADD CONSTRAINT "Watchlist_createdById_fkey" FOREIGN KEY ("createdById") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
+2 -2
View File
@@ -2268,8 +2268,8 @@ model Watchlist {
action WatchlistAction @default(REPORT)
severity WatchlistSeverity @default(LOW)
createdAt DateTime @default(now())
createdBy User @relation("CreatedWatchlists", onDelete: SetNull, fields: [createdById], references: [id])
createdById Int
createdBy User? @relation("CreatedWatchlists", onDelete: SetNull, fields: [createdById], references: [id])
createdById Int?
updatedAt DateTime @updatedAt
updatedBy User? @relation("UpdatedWatchlists", onDelete: SetNull, fields: [updatedById], references: [id])
updatedById Int?