Chore(backend): Enable attaching attachments to companies and people (backend) (#1726)
Enable attaching attachments to companies and people (backend) Co-authored-by: v1b3m <vibenjamin6@gmail.com>
This commit is contained in:
@ -0,0 +1,10 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "attachments" ADD COLUMN "companyId" TEXT,
|
||||
ADD COLUMN "personId" TEXT,
|
||||
ALTER COLUMN "activityId" DROP NOT NULL;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "attachments" ADD CONSTRAINT "attachments_personId_fkey" FOREIGN KEY ("personId") REFERENCES "people"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "attachments" ADD CONSTRAINT "attachments_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "companies"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@ -270,6 +270,7 @@ model Company {
|
||||
ActivityTarget ActivityTarget[]
|
||||
PipelineProgress PipelineProgress[]
|
||||
Favorite Favorite[]
|
||||
Attachment Attachment[]
|
||||
|
||||
@@map("companies")
|
||||
}
|
||||
@ -322,6 +323,7 @@ model Person {
|
||||
ActivityTarget ActivityTarget[]
|
||||
PipelineProgress PipelineProgress[]
|
||||
Favorite Favorite[]
|
||||
Attachment Attachment[]
|
||||
|
||||
@@map("people")
|
||||
}
|
||||
@ -580,8 +582,15 @@ model Attachment {
|
||||
workspaceMemberAuthor WorkspaceMember? @relation(fields: [workspaceMemberAuthorId], references: [id], name: "authoredAttachments", onDelete: Cascade)
|
||||
workspaceMemberAuthorId String?
|
||||
|
||||
activity Activity @relation(fields: [activityId], references: [id], onDelete: Cascade)
|
||||
activityId String
|
||||
activity Activity? @relation(fields: [activityId], references: [id], onDelete: Cascade)
|
||||
activityId String?
|
||||
|
||||
/// @TypeGraphQL.omit(input: true, output: false)
|
||||
person Person? @relation(fields: [personId], references: [id], onDelete: Cascade)
|
||||
personId String?
|
||||
/// @TypeGraphQL.omit(input: true, output: false)
|
||||
company Company? @relation(fields: [companyId], references: [id], onDelete: Cascade)
|
||||
companyId String?
|
||||
|
||||
/// @TypeGraphQL.omit(input: true, output: false)
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id])
|
||||
|
||||
Reference in New Issue
Block a user