fix: allow nullable document audit logs (#2682)

This commit is contained in:
Lucas Smith 2026-04-08 16:23:43 +10:00 committed by GitHub
parent 4c69cb9c66
commit 7cb64c3d04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -0,0 +1,8 @@
-- DropForeignKey
ALTER TABLE "DocumentAuditLog" DROP CONSTRAINT "DocumentAuditLog_envelopeId_fkey";
-- AlterTable
ALTER TABLE "DocumentAuditLog" ALTER COLUMN "envelopeId" DROP NOT NULL;
-- AddForeignKey
ALTER TABLE "DocumentAuditLog" ADD CONSTRAINT "DocumentAuditLog_envelopeId_fkey" FOREIGN KEY ("envelopeId") REFERENCES "Envelope"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View file

@ -466,7 +466,7 @@ model EnvelopeItem {
model DocumentAuditLog {
id String @id @default(cuid())
envelopeId String
envelopeId String?
createdAt DateTime @default(now())
type String
data Json
@ -478,7 +478,7 @@ model DocumentAuditLog {
userAgent String?
ipAddress String?
envelope Envelope @relation(fields: [envelopeId], references: [id], onDelete: Cascade)
envelope Envelope? @relation(fields: [envelopeId], references: [id], onDelete: SetNull)
@@index([envelopeId])
}