From 127db88056e01e72e3aa201571e557a09c2ed3c4 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Mon, 21 Oct 2024 17:26:35 +0700 Subject: [PATCH] feat: add installments data --- .../migration.sql | 8 +++++++ prisma/schema.prisma | 22 +++++++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 prisma/migrations/20241021102607_add_installments_payment_data/migration.sql diff --git a/prisma/migrations/20241021102607_add_installments_payment_data/migration.sql b/prisma/migrations/20241021102607_add_installments_payment_data/migration.sql new file mode 100644 index 0000000..e47beef --- /dev/null +++ b/prisma/migrations/20241021102607_add_installments_payment_data/migration.sql @@ -0,0 +1,8 @@ +-- AlterTable +ALTER TABLE "RequestWork" ADD COLUMN "attributes" JSONB; + +-- AlterTable +ALTER TABLE "Service" ADD COLUMN "installments" INTEGER NOT NULL DEFAULT 0; + +-- AlterTable +ALTER TABLE "WorkProduct" ADD COLUMN "installmentNo" INTEGER NOT NULL DEFAULT 0; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 9d8ca0b..0184e97 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -1004,10 +1004,11 @@ model Product { model Service { id String @id @default(cuid()) - code String - name String - detail String - attributes Json? + code String + name String + detail String + attributes Json? + installments Int @default(0) status Status @default(CREATED) statusOrder Int @default(0) @@ -1057,11 +1058,12 @@ model Work { } model WorkProduct { - order Int - work Work @relation(fields: [workId], references: [id], onDelete: Cascade) - workId String - product Product @relation(fields: [productId], references: [id], onDelete: Cascade) - productId String + order Int + work Work @relation(fields: [workId], references: [id], onDelete: Cascade) + workId String + product Product @relation(fields: [productId], references: [id], onDelete: Cascade) + productId String + installmentNo Int @default(0) createdAt DateTime @default(now()) createdBy User? @relation(name: "WorkProductCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull) @@ -1256,4 +1258,6 @@ model RequestWork { processByUser User? @relation(fields: [processByUserId], references: [id]) processByUserId String? + + attributes Json? }