feat: update work endpoints
This commit is contained in:
parent
39206a6d76
commit
51fd6b0589
4 changed files with 76 additions and 72 deletions
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `WorkService` table. If the table is not empty, all the data it contains will be lost.
|
||||
- Added the required column `order` to the `Work` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "WorkService" DROP CONSTRAINT "WorkService_serviceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "WorkService" DROP CONSTRAINT "WorkService_workId_fkey";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Work" ADD COLUMN "order" INTEGER NOT NULL,
|
||||
ADD COLUMN "serviceId" TEXT;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "WorkService";
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Work" ADD CONSTRAINT "Work_serviceId_fkey" FOREIGN KEY ("serviceId") REFERENCES "Service"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
|
@ -543,45 +543,32 @@ model Service {
|
|||
attributes Json?
|
||||
|
||||
status Status @default(CREATED)
|
||||
work Work[]
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
workOnService WorkService[]
|
||||
}
|
||||
|
||||
model Work {
|
||||
id String @id @default(uuid())
|
||||
|
||||
order Int
|
||||
name String
|
||||
attributes Json?
|
||||
|
||||
status Status @default(CREATED)
|
||||
|
||||
service Service? @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
||||
serviceId String?
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
productOnWork WorkProduct[]
|
||||
serviceOnWork WorkService[]
|
||||
}
|
||||
|
||||
model WorkService {
|
||||
order Int
|
||||
work Work @relation(fields: [workId], references: [id], onDelete: Cascade)
|
||||
workId String
|
||||
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
||||
serviceId String
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@id([workId, serviceId])
|
||||
}
|
||||
|
||||
model WorkProduct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue