Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated schema #75

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading