Skip to content

Commit

Permalink
updated schema
Browse files Browse the repository at this point in the history
  • Loading branch information
richard483 committed Jan 27, 2024
1 parent 30bf4b5 commit 1baacf5
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backend-8tech",
"version": "4.2.6",
"version": "4.2.7",
"description": "",
"author": "8tech",
"private": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
-- DropForeignKey
ALTER TABLE "Contract" DROP CONSTRAINT "Contract_jobId_fkey";

-- DropForeignKey
ALTER TABLE "Contract" DROP CONSTRAINT "Contract_paymentId_fkey";

-- DropForeignKey
ALTER TABLE "Contract" DROP CONSTRAINT "Contract_ratingId_fkey";

-- DropForeignKey
ALTER TABLE "Contract" DROP CONSTRAINT "Contract_userId_fkey";

-- DropForeignKey
ALTER TABLE "JobVacancy" DROP CONSTRAINT "JobVacancy_companyId_fkey";

-- DropForeignKey
ALTER TABLE "Rating" DROP CONSTRAINT "Rating_userId_fkey";

-- DropForeignKey
ALTER TABLE "User" DROP CONSTRAINT "User_companyId_fkey";

-- AddForeignKey
ALTER TABLE "User" ADD CONSTRAINT "User_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "Company"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "JobVacancy" ADD CONSTRAINT "JobVacancy_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "Company"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Contract" ADD CONSTRAINT "Contract_jobId_fkey" FOREIGN KEY ("jobId") REFERENCES "JobVacancy"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Contract" ADD CONSTRAINT "Contract_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Contract" ADD CONSTRAINT "Contract_paymentId_fkey" FOREIGN KEY ("paymentId") REFERENCES "Payment"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Contract" ADD CONSTRAINT "Contract_ratingId_fkey" FOREIGN KEY ("ratingId") REFERENCES "Rating"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Rating" ADD CONSTRAINT "Rating_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
14 changes: 7 additions & 7 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ model User {
portfolio String[] @map("portfolio")
profilePicture String?
hasGoogleAccount Boolean @default(false)
company Company? @relation(fields: [companyId], references: [id])
company Company? @relation(fields: [companyId], references: [id], onDelete: Cascade)
contract Contract[]
}

Expand All @@ -43,7 +43,7 @@ model JobVacancy {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
// company Id is optional for current development purposes
company Company? @relation(fields: [companyId], references: [id])
company Company? @relation(fields: [companyId], references: [id], onDelete: Cascade)
companyId String?
contracts Contract[]
}
Expand Down Expand Up @@ -74,10 +74,10 @@ model Contract {
customField String?
workSubmission String?
ratingId String?
jobVacancy JobVacancy? @relation(fields: [jobId], references: [id])
user User? @relation(fields: [userId], references: [id])
payment Payment? @relation(fields: [paymentId], references: [id])
rating Rating? @relation(fields: [ratingId], references: [id])
jobVacancy JobVacancy? @relation(fields: [jobId], references: [id], onDelete: Cascade)
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
payment Payment? @relation(fields: [paymentId], references: [id], onDelete: Cascade)
rating Rating? @relation(fields: [ratingId], references: [id], onDelete: Cascade)
}

model Payment {
Expand All @@ -92,7 +92,7 @@ model Payment {

model Rating {
id String @id @default(uuid())
User User @relation(fields: [userId], references: [id])
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String
recruiterUserId String
ratingOf10 Int
Expand Down

0 comments on commit 1baacf5

Please sign in to comment.