refactor: update constraints
This commit is contained in:
parent
8f5f4822f9
commit
126a44cb7f
2 changed files with 20 additions and 3 deletions
|
|
@ -0,0 +1,17 @@
|
|||
-- DropForeignKey
|
||||
ALTER TABLE "QuotationService" DROP CONSTRAINT "QuotationService_quotationId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "QuotationServiceWork" DROP CONSTRAINT "QuotationServiceWork_serviceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "QuotationServiceWorkProduct" DROP CONSTRAINT "QuotationServiceWorkProduct_workId_fkey";
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "QuotationService" ADD CONSTRAINT "QuotationService_quotationId_fkey" FOREIGN KEY ("quotationId") REFERENCES "Quotation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "QuotationServiceWork" ADD CONSTRAINT "QuotationServiceWork_serviceId_fkey" FOREIGN KEY ("serviceId") REFERENCES "QuotationService"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "QuotationServiceWorkProduct" ADD CONSTRAINT "QuotationServiceWorkProduct_workId_fkey" FOREIGN KEY ("workId") REFERENCES "QuotationServiceWork"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
|
@ -858,7 +858,7 @@ model QuotationService {
|
|||
refServiceId String
|
||||
refService Service @relation(fields: [refServiceId], references: [id])
|
||||
|
||||
quotation Quotation @relation(fields: [quotationId], references: [id])
|
||||
quotation Quotation @relation(fields: [quotationId], references: [id], onDelete: Cascade)
|
||||
quotationId String
|
||||
}
|
||||
|
||||
|
|
@ -869,7 +869,7 @@ model QuotationServiceWork {
|
|||
name String
|
||||
attributes Json?
|
||||
|
||||
service QuotationService @relation(fields: [serviceId], references: [id])
|
||||
service QuotationService @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
||||
serviceId String
|
||||
|
||||
productOnWork QuotationServiceWorkProduct[]
|
||||
|
|
@ -877,7 +877,7 @@ model QuotationServiceWork {
|
|||
|
||||
model QuotationServiceWorkProduct {
|
||||
order Int
|
||||
work QuotationServiceWork @relation(fields: [workId], references: [id])
|
||||
work QuotationServiceWork @relation(fields: [workId], references: [id], onDelete: Cascade)
|
||||
workId String
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||
productId String
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue