[questions][chore] update to use company table values (#351)

Co-authored-by: Jeff Sieu <jeffsy00@gmail.com>
This commit is contained in:
hpkoh
2022-10-19 18:08:51 +08:00
committed by GitHub
parent 410bf290c9
commit 2f12a900e6
6 changed files with 106 additions and 95 deletions

View File

@ -0,0 +1,13 @@
/*
Warnings:
- You are about to drop the column `company` on the `QuestionsQuestionEncounter` table. All the data in the column will be lost.
- Added the required column `companyId` to the `QuestionsQuestionEncounter` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "QuestionsQuestionEncounter" DROP COLUMN "company",
ADD COLUMN "companyId" TEXT NOT NULL;
-- AddForeignKey
ALTER TABLE "QuestionsQuestionEncounter" ADD CONSTRAINT "QuestionsQuestionEncounter_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "Company"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View File

@ -91,15 +91,17 @@ enum TodoStatus {
}
model Company {
id String @id @default(cuid())
name String @db.Text
slug String @unique
description String? @db.Text
logoUrl String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
OffersExperience OffersExperience[]
OffersOffer OffersOffer[]
id String @id @default(cuid())
name String @db.Text
slug String @unique
description String? @db.Text
logoUrl String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
questionsQuestionEncounter QuestionsQuestionEncounter[]
OffersExperience OffersExperience[]
OffersOffer OffersOffer[]
}
// Start of Resumes project models.
@ -403,19 +405,20 @@ model QuestionsQuestion {
}
model QuestionsQuestionEncounter {
id String @id @default(cuid())
questionId String
userId String?
// TODO: sync with models
company String @db.Text
location String @db.Text
role String @db.Text
seenAt DateTime
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
id String @id @default(cuid())
questionId String
userId String?
// TODO: sync with models (location, role)
companyId String
location String @db.Text
role String @db.Text
seenAt DateTime
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
question QuestionsQuestion @relation(fields: [questionId], references: [id], onDelete: Cascade)
company Company? @relation(fields: [companyId], references: [id], onDelete: SetNull)
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
question QuestionsQuestion @relation(fields: [questionId], references: [id], onDelete: Cascade)
}
model QuestionsQuestionVote {