feat: add creatorId to report database schema
should've been part of commit 36f0ff83
This commit is contained in:
parent
0ace0f1703
commit
745a2e0c54
2 changed files with 16 additions and 8 deletions
|
|
@ -0,0 +1,5 @@
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "reports" ADD COLUMN "creatorId" INTEGER;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "reports" ADD CONSTRAINT "reports_creatorId_fkey" FOREIGN KEY ("creatorId") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
|
|
@ -21,11 +21,12 @@ model User {
|
||||||
usernameUpdatedAt DateTime?
|
usernameUpdatedAt DateTime?
|
||||||
imageUpdatedAt DateTime?
|
imageUpdatedAt DateTime?
|
||||||
|
|
||||||
accounts Account[]
|
accounts Account[]
|
||||||
sessions Session[]
|
sessions Session[]
|
||||||
miis Mii[]
|
miis Mii[]
|
||||||
likes Like[]
|
likes Like[]
|
||||||
Report Report[]
|
reportsAuthored Report[] @relation("ReportAuthor")
|
||||||
|
reports Report[] @relation("ReportTargetCreator")
|
||||||
|
|
||||||
@@map("users")
|
@@map("users")
|
||||||
}
|
}
|
||||||
|
|
@ -106,11 +107,13 @@ model Report {
|
||||||
reason ReportReason
|
reason ReportReason
|
||||||
reasonNotes String?
|
reasonNotes String?
|
||||||
|
|
||||||
// note: this refers to the person who made the report
|
|
||||||
authorId Int?
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
|
|
||||||
user User? @relation(fields: [authorId], references: [id])
|
// note: this refers to the person who made the report
|
||||||
|
authorId Int?
|
||||||
|
author User? @relation("ReportAuthor", fields: [authorId], references: [id])
|
||||||
|
creatorId Int?
|
||||||
|
creator User? @relation("ReportTargetCreator", fields: [creatorId], references: [id])
|
||||||
|
|
||||||
@@map("reports")
|
@@map("reports")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue