diff --git a/prisma/migrations/20240409065557_update_customer/migration.sql b/prisma/migrations/20240409065557_update_customer/migration.sql deleted file mode 100644 index f5291b9..0000000 --- a/prisma/migrations/20240409065557_update_customer/migration.sql +++ /dev/null @@ -1,14 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `imageUrl` on the `Customer` table. All the data in the column will be lost. - - Changed the type of `customerType` on the `Customer` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. - -*/ --- CreateEnum -CREATE TYPE "CustomerType" AS ENUM ('CORP', 'PERS'); - --- AlterTable -ALTER TABLE "Customer" DROP COLUMN "imageUrl", -DROP COLUMN "customerType", -ADD COLUMN "customerType" "CustomerType" NOT NULL; diff --git a/prisma/migrations/20240410043453_add_missing_user_field/migration.sql b/prisma/migrations/20240410043453_add_missing_user_field/migration.sql deleted file mode 100644 index a32f678..0000000 --- a/prisma/migrations/20240410043453_add_missing_user_field/migration.sql +++ /dev/null @@ -1,3 +0,0 @@ --- AlterTable -ALTER TABLE "User" ADD COLUMN "birtDate" TIMESTAMP(3), -ADD COLUMN "responsibleArea" TEXT; diff --git a/prisma/migrations/20240410053228_fix_typo/migration.sql b/prisma/migrations/20240410053228_fix_typo/migration.sql deleted file mode 100644 index 59c29dd..0000000 --- a/prisma/migrations/20240410053228_fix_typo/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `birtDate` on the `User` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "User" DROP COLUMN "birtDate", -ADD COLUMN "birthDate" TIMESTAMP(3); diff --git a/prisma/migrations/20240417020614_remove_field/migration.sql b/prisma/migrations/20240417020614_remove_field/migration.sql deleted file mode 100644 index 3cb801f..0000000 --- a/prisma/migrations/20240417020614_remove_field/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `keycloakId` on the `User` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "User" DROP COLUMN "keycloakId"; diff --git a/prisma/migrations/20240417041541_move_field/migration.sql b/prisma/migrations/20240417041541_move_field/migration.sql deleted file mode 100644 index 3b720dc..0000000 --- a/prisma/migrations/20240417041541_move_field/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `lineId` on the `BranchContact` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "Branch" ADD COLUMN "lineId" TEXT; - --- AlterTable -ALTER TABLE "BranchContact" DROP COLUMN "lineId"; diff --git a/prisma/migrations/20240417063829_update_table/migration.sql b/prisma/migrations/20240417063829_update_table/migration.sql deleted file mode 100644 index 8b7bd17..0000000 --- a/prisma/migrations/20240417063829_update_table/migration.sql +++ /dev/null @@ -1,119 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `telephoneNo` on the `Branch` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "Branch" DROP COLUMN "telephoneNo"; - --- CreateTable -CREATE TABLE "Menu" ( - "id" TEXT NOT NULL, - "caption" TEXT NOT NULL, - "captionEN" TEXT NOT NULL, - "menuType" TEXT NOT NULL, - "url" TEXT NOT NULL, - "createdBy" TEXT, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, - "updatedAt" TIMESTAMP(3) NOT NULL, - "parentId" TEXT, - - CONSTRAINT "Menu_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "RoleMenuPermission" ( - "id" TEXT NOT NULL, - "userRole" TEXT NOT NULL, - "permission" TEXT NOT NULL, - "menuId" TEXT NOT NULL, - "createdBy" TEXT, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "RoleMenuPermission_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "UserMenuPermission" ( - "id" TEXT NOT NULL, - "permission" TEXT NOT NULL, - "menuId" TEXT NOT NULL, - "userId" TEXT NOT NULL, - "createdBy" TEXT, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "UserMenuPermission_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "MenuComponent" ( - "id" TEXT NOT NULL, - "componentId" TEXT NOT NULL, - "componentTag" TEXT NOT NULL, - "menuId" TEXT NOT NULL, - "createdBy" TEXT, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "MenuComponent_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "RoleMenuComponentPermission" ( - "id" TEXT NOT NULL, - "componentId" TEXT NOT NULL, - "componentTag" TEXT NOT NULL, - "menuComponentId" TEXT NOT NULL, - "permission" TEXT NOT NULL, - "createdBy" TEXT, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "RoleMenuComponentPermission_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "UserMenuComponentPermission" ( - "id" TEXT NOT NULL, - "userId" TEXT NOT NULL, - "menuComponentId" TEXT NOT NULL, - "permission" TEXT NOT NULL, - "createdBy" TEXT, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "UserMenuComponentPermission_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "Menu" ADD CONSTRAINT "Menu_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "Menu"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "RoleMenuPermission" ADD CONSTRAINT "RoleMenuPermission_menuId_fkey" FOREIGN KEY ("menuId") REFERENCES "Menu"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "UserMenuPermission" ADD CONSTRAINT "UserMenuPermission_menuId_fkey" FOREIGN KEY ("menuId") REFERENCES "Menu"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "UserMenuPermission" ADD CONSTRAINT "UserMenuPermission_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "MenuComponent" ADD CONSTRAINT "MenuComponent_menuId_fkey" FOREIGN KEY ("menuId") REFERENCES "Menu"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "RoleMenuComponentPermission" ADD CONSTRAINT "RoleMenuComponentPermission_menuComponentId_fkey" FOREIGN KEY ("menuComponentId") REFERENCES "MenuComponent"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "UserMenuComponentPermission" ADD CONSTRAINT "UserMenuComponentPermission_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "UserMenuComponentPermission" ADD CONSTRAINT "UserMenuComponentPermission_menuComponentId_fkey" FOREIGN KEY ("menuComponentId") REFERENCES "MenuComponent"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240417064127_add_missing_user_field/migration.sql b/prisma/migrations/20240417064127_add_missing_user_field/migration.sql deleted file mode 100644 index b0b8442..0000000 --- a/prisma/migrations/20240417064127_add_missing_user_field/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "Branch" ADD COLUMN "contactName" TEXT; diff --git a/prisma/migrations/20240417091605_add_missing_user_field_checkpoint/migration.sql b/prisma/migrations/20240417091605_add_missing_user_field_checkpoint/migration.sql deleted file mode 100644 index 30b641e..0000000 --- a/prisma/migrations/20240417091605_add_missing_user_field_checkpoint/migration.sql +++ /dev/null @@ -1,3 +0,0 @@ --- AlterTable -ALTER TABLE "User" ADD COLUMN "checkpoint" TEXT, -ADD COLUMN "checkpointEN" TEXT; diff --git a/prisma/migrations/20240417094807_add_username_field/migration.sql b/prisma/migrations/20240417094807_add_username_field/migration.sql deleted file mode 100644 index 2d730b3..0000000 --- a/prisma/migrations/20240417094807_add_username_field/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - Added the required column `username` to the `User` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "User" ADD COLUMN "username" TEXT NOT NULL; diff --git a/prisma/migrations/20240418042147_fix_missing_field/migration.sql b/prisma/migrations/20240418042147_fix_missing_field/migration.sql deleted file mode 100644 index c22f622..0000000 --- a/prisma/migrations/20240418042147_fix_missing_field/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `componentId` on the `RoleMenuComponentPermission` table. All the data in the column will be lost. - - You are about to drop the column `componentTag` on the `RoleMenuComponentPermission` table. All the data in the column will be lost. - - Added the required column `userRole` to the `RoleMenuComponentPermission` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "RoleMenuComponentPermission" DROP COLUMN "componentId", -DROP COLUMN "componentTag", -ADD COLUMN "userRole" TEXT NOT NULL; diff --git a/prisma/migrations/20240418060611_add_hq_tel_field/migration.sql b/prisma/migrations/20240418060611_add_hq_tel_field/migration.sql deleted file mode 100644 index ae17c14..0000000 --- a/prisma/migrations/20240418060611_add_hq_tel_field/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "Branch" ADD COLUMN "telephoneHq" TEXT; diff --git a/prisma/migrations/20240418060739_remove_optional_hq_tel/migration.sql b/prisma/migrations/20240418060739_remove_optional_hq_tel/migration.sql deleted file mode 100644 index 922dfa6..0000000 --- a/prisma/migrations/20240418060739_remove_optional_hq_tel/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - Made the column `telephoneHq` on table `Branch` required. This step will fail if there are existing NULL values in that column. - -*/ --- AlterTable -ALTER TABLE "Branch" ALTER COLUMN "telephoneHq" SET NOT NULL; diff --git a/prisma/migrations/20240418061959_rename_field/migration.sql b/prisma/migrations/20240418061959_rename_field/migration.sql deleted file mode 100644 index 6233aa1..0000000 --- a/prisma/migrations/20240418061959_rename_field/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `telephoneHq` on the `Branch` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "Branch" DROP COLUMN "telephoneHq", -ADD COLUMN "telephoneNo" TEXT; diff --git a/prisma/migrations/20240418062042_remove_optional/migration.sql b/prisma/migrations/20240418062042_remove_optional/migration.sql deleted file mode 100644 index ca8ae37..0000000 --- a/prisma/migrations/20240418062042_remove_optional/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - Made the column `telephoneNo` on table `Branch` required. This step will fail if there are existing NULL values in that column. - -*/ --- AlterTable -ALTER TABLE "Branch" ALTER COLUMN "telephoneNo" SET NOT NULL; diff --git a/prisma/migrations/20240422092016_add_running_no_table/migration.sql b/prisma/migrations/20240422092016_add_running_no_table/migration.sql deleted file mode 100644 index ad777a0..0000000 --- a/prisma/migrations/20240422092016_add_running_no_table/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ --- CreateTable -CREATE TABLE "RunningNo" ( - "key" TEXT NOT NULL, - "value" INTEGER NOT NULL, - - CONSTRAINT "RunningNo_pkey" PRIMARY KEY ("key") -); - --- CreateIndex -CREATE UNIQUE INDEX "RunningNo_key_key" ON "RunningNo"("key"); diff --git a/prisma/migrations/20240423104607_add_missing_field/migration.sql b/prisma/migrations/20240423104607_add_missing_field/migration.sql deleted file mode 100644 index 6c8a704..0000000 --- a/prisma/migrations/20240423104607_add_missing_field/migration.sql +++ /dev/null @@ -1,28 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `latitude` on the `CustomerBranch` table. All the data in the column will be lost. - - You are about to drop the column `longitude` on the `CustomerBranch` table. All the data in the column will be lost. - - Added the required column `bussinessType` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty. - - Added the required column `employmentOffice` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty. - - Added the required column `jobDescription` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty. - - Added the required column `jobPosition` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty. - - Added the required column `payDate` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty. - - Added the required column `saleEmployee` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty. - - Added the required column `wageDate` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "Customer" ADD COLUMN "taxNo" TEXT; - --- AlterTable -ALTER TABLE "CustomerBranch" DROP COLUMN "latitude", -DROP COLUMN "longitude", -ADD COLUMN "bussinessType" TEXT NOT NULL, -ADD COLUMN "employmentOffice" TEXT NOT NULL, -ADD COLUMN "jobDescription" TEXT NOT NULL, -ADD COLUMN "jobPosition" TEXT NOT NULL, -ADD COLUMN "payDate" TEXT NOT NULL, -ADD COLUMN "saleEmployee" TEXT NOT NULL, -ADD COLUMN "wageDate" TEXT NOT NULL, -ALTER COLUMN "taxNo" DROP NOT NULL; diff --git a/prisma/migrations/20240424030115_add_missing_field_en/migration.sql b/prisma/migrations/20240424030115_add_missing_field_en/migration.sql deleted file mode 100644 index d3726ca..0000000 --- a/prisma/migrations/20240424030115_add_missing_field_en/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - Added the required column `bussinessTypeEN` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty. - - Added the required column `jobPositionEN` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "CustomerBranch" ADD COLUMN "bussinessTypeEN" TEXT NOT NULL, -ADD COLUMN "jobPositionEN" TEXT NOT NULL; diff --git a/prisma/migrations/20240607065019_update_data_type/migration.sql b/prisma/migrations/20240607065019_update_data_type/migration.sql deleted file mode 100644 index b72dc89..0000000 --- a/prisma/migrations/20240607065019_update_data_type/migration.sql +++ /dev/null @@ -1,15 +0,0 @@ -/* - Warnings: - - - Changed the type of `branchNo` on the `CustomerBranch` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. - - Changed the type of `payDate` on the `CustomerBranch` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. - - Changed the type of `wageDate` on the `CustomerBranch` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. - -*/ --- AlterTable -ALTER TABLE "CustomerBranch" DROP COLUMN "branchNo", -ADD COLUMN "branchNo" INTEGER NOT NULL, -DROP COLUMN "payDate", -ADD COLUMN "payDate" TIMESTAMP(3) NOT NULL, -DROP COLUMN "wageDate", -ADD COLUMN "wageDate" TIMESTAMP(3) NOT NULL; diff --git a/prisma/migrations/20240607070114_fix_wrong_field/migration.sql b/prisma/migrations/20240607070114_fix_wrong_field/migration.sql deleted file mode 100644 index a5494e8..0000000 --- a/prisma/migrations/20240607070114_fix_wrong_field/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `wageDate` on the `CustomerBranch` table. All the data in the column will be lost. - - Added the required column `wageRate` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "CustomerBranch" DROP COLUMN "wageDate", -ADD COLUMN "wageRate" INTEGER NOT NULL; diff --git a/prisma/migrations/20240610061629_add_field/migration.sql b/prisma/migrations/20240610061629_add_field/migration.sql deleted file mode 100644 index bea038e..0000000 --- a/prisma/migrations/20240610061629_add_field/migration.sql +++ /dev/null @@ -1,30 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `birthPlace` on the `EmployeeOtherInfo` table. All the data in the column will be lost. - - You are about to drop the column `fatherFullName` on the `EmployeeOtherInfo` table. All the data in the column will be lost. - - You are about to drop the column `motherFullName` on the `EmployeeOtherInfo` table. All the data in the column will be lost. - - Added the required column `birthPlaceEN` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty. - - Added the required column `fatherFirstName` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty. - - Added the required column `fatherFirstNameEN` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty. - - Added the required column `fatherLastName` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty. - - Added the required column `fatherLastNameEN` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty. - - Added the required column `motherFirstName` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty. - - Added the required column `motherFirstNameEN` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty. - - Added the required column `motherLastName` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty. - - Added the required column `motherLastNameEN` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "EmployeeOtherInfo" DROP COLUMN "birthPlace", -DROP COLUMN "fatherFullName", -DROP COLUMN "motherFullName", -ADD COLUMN "birthPlaceEN" TEXT NOT NULL, -ADD COLUMN "fatherFirstName" TEXT NOT NULL, -ADD COLUMN "fatherFirstNameEN" TEXT NOT NULL, -ADD COLUMN "fatherLastName" TEXT NOT NULL, -ADD COLUMN "fatherLastNameEN" TEXT NOT NULL, -ADD COLUMN "motherFirstName" TEXT NOT NULL, -ADD COLUMN "motherFirstNameEN" TEXT NOT NULL, -ADD COLUMN "motherLastName" TEXT NOT NULL, -ADD COLUMN "motherLastNameEN" TEXT NOT NULL; diff --git a/prisma/migrations/20240610062435_fix_prev_typo/migration.sql b/prisma/migrations/20240610062435_fix_prev_typo/migration.sql deleted file mode 100644 index 23b59f5..0000000 --- a/prisma/migrations/20240610062435_fix_prev_typo/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `birthPlaceEN` on the `EmployeeOtherInfo` table. All the data in the column will be lost. - - Added the required column `birthPlace` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "EmployeeOtherInfo" DROP COLUMN "birthPlaceEN", -ADD COLUMN "birthPlace" TEXT NOT NULL; diff --git a/prisma/migrations/20240610074721_update_field/migration.sql b/prisma/migrations/20240610074721_update_field/migration.sql deleted file mode 100644 index d6e7653..0000000 --- a/prisma/migrations/20240610074721_update_field/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `imageUrl` on the `Product` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "EmployeeWork" ADD COLUMN "remark" TEXT; - --- AlterTable -ALTER TABLE "Product" DROP COLUMN "imageUrl"; diff --git a/prisma/migrations/20240610094945_change_employee_fields/migration.sql b/prisma/migrations/20240610094945_change_employee_fields/migration.sql deleted file mode 100644 index e20d1e0..0000000 --- a/prisma/migrations/20240610094945_change_employee_fields/migration.sql +++ /dev/null @@ -1,45 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `arrivalBarricade` on the `Employee` table. All the data in the column will be lost. - - You are about to drop the column `arrivalCardNo` on the `Employee` table. All the data in the column will be lost. - - You are about to drop the column `email` on the `Employee` table. All the data in the column will be lost. - - You are about to drop the column `telephoneNo` on the `Employee` table. All the data in the column will be lost. - - Added the required column `entryDate` to the `Employee` table without a default value. This is not possible if the table is not empty. - - Added the required column `passportExpiryDate` to the `Employee` table without a default value. This is not possible if the table is not empty. - - Added the required column `passportIssueDate` to the `Employee` table without a default value. This is not possible if the table is not empty. - - Added the required column `passportIssuingCountry` to the `Employee` table without a default value. This is not possible if the table is not empty. - - Added the required column `passportIssuingPlace` to the `Employee` table without a default value. This is not possible if the table is not empty. - - Added the required column `passportNumber` to the `Employee` table without a default value. This is not possible if the table is not empty. - - Added the required column `passportType` to the `Employee` table without a default value. This is not possible if the table is not empty. - - Added the required column `tm6Number` to the `Employee` table without a default value. This is not possible if the table is not empty. - - Added the required column `visaExpiryDate` to the `Employee` table without a default value. This is not possible if the table is not empty. - - Added the required column `visaIssueDate` to the `Employee` table without a default value. This is not possible if the table is not empty. - - Added the required column `visaIssuingPlace` to the `Employee` table without a default value. This is not possible if the table is not empty. - - Added the required column `visaNumber` to the `Employee` table without a default value. This is not possible if the table is not empty. - - Added the required column `visaStayUntilDate` to the `Employee` table without a default value. This is not possible if the table is not empty. - - Added the required column `visaType` to the `Employee` table without a default value. This is not possible if the table is not empty. - - Added the required column `workerStatus` to the `Employee` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "Employee" DROP COLUMN "arrivalBarricade", -DROP COLUMN "arrivalCardNo", -DROP COLUMN "email", -DROP COLUMN "telephoneNo", -ADD COLUMN "entryDate" TIMESTAMP(3) NOT NULL, -ADD COLUMN "passportExpiryDate" TIMESTAMP(3) NOT NULL, -ADD COLUMN "passportIssueDate" TIMESTAMP(3) NOT NULL, -ADD COLUMN "passportIssuingCountry" TEXT NOT NULL, -ADD COLUMN "passportIssuingPlace" TEXT NOT NULL, -ADD COLUMN "passportNumber" TEXT NOT NULL, -ADD COLUMN "passportType" TEXT NOT NULL, -ADD COLUMN "previousPassportReference" TEXT, -ADD COLUMN "tm6Number" TEXT NOT NULL, -ADD COLUMN "visaExpiryDate" TIMESTAMP(3) NOT NULL, -ADD COLUMN "visaIssueDate" TIMESTAMP(3) NOT NULL, -ADD COLUMN "visaIssuingPlace" TEXT NOT NULL, -ADD COLUMN "visaNumber" TEXT NOT NULL, -ADD COLUMN "visaStayUntilDate" TIMESTAMP(3) NOT NULL, -ADD COLUMN "visaType" TEXT NOT NULL, -ADD COLUMN "workerStatus" TEXT NOT NULL; diff --git a/prisma/migrations/20240611040600_make_field_optional/migration.sql b/prisma/migrations/20240611040600_make_field_optional/migration.sql deleted file mode 100644 index 595a50d..0000000 --- a/prisma/migrations/20240611040600_make_field_optional/migration.sql +++ /dev/null @@ -1,31 +0,0 @@ --- AlterTable -ALTER TABLE "EmployeeCheckup" ALTER COLUMN "checkupResult" DROP NOT NULL, -ALTER COLUMN "checkupType" DROP NOT NULL, -ALTER COLUMN "hospitalName" DROP NOT NULL, -ALTER COLUMN "remark" DROP NOT NULL, -ALTER COLUMN "medicalBenefitScheme" DROP NOT NULL, -ALTER COLUMN "insuranceCompany" DROP NOT NULL, -ALTER COLUMN "coverageStartDate" DROP NOT NULL, -ALTER COLUMN "coverageExpireDate" DROP NOT NULL; - --- AlterTable -ALTER TABLE "EmployeeOtherInfo" ALTER COLUMN "citizenId" DROP NOT NULL, -ALTER COLUMN "fatherFirstName" DROP NOT NULL, -ALTER COLUMN "fatherFirstNameEN" DROP NOT NULL, -ALTER COLUMN "fatherLastName" DROP NOT NULL, -ALTER COLUMN "fatherLastNameEN" DROP NOT NULL, -ALTER COLUMN "motherFirstName" DROP NOT NULL, -ALTER COLUMN "motherFirstNameEN" DROP NOT NULL, -ALTER COLUMN "motherLastName" DROP NOT NULL, -ALTER COLUMN "motherLastNameEN" DROP NOT NULL, -ALTER COLUMN "birthPlace" DROP NOT NULL; - --- AlterTable -ALTER TABLE "EmployeeWork" ALTER COLUMN "ownerName" DROP NOT NULL, -ALTER COLUMN "positionName" DROP NOT NULL, -ALTER COLUMN "jobType" DROP NOT NULL, -ALTER COLUMN "workplace" DROP NOT NULL, -ALTER COLUMN "workPermitNo" DROP NOT NULL, -ALTER COLUMN "workPermitIssuDate" DROP NOT NULL, -ALTER COLUMN "workPermitExpireDate" DROP NOT NULL, -ALTER COLUMN "workEndDate" DROP NOT NULL; diff --git a/prisma/migrations/20240611042536_add_field/migration.sql b/prisma/migrations/20240611042536_add_field/migration.sql deleted file mode 100644 index d98d0b1..0000000 --- a/prisma/migrations/20240611042536_add_field/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `birthPlace` on the `EmployeeOtherInfo` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "EmployeeOtherInfo" DROP COLUMN "birthPlace", -ADD COLUMN "fatherBirthPlace" TEXT, -ADD COLUMN "motherBirthPlace" TEXT; diff --git a/prisma/migrations/20240611060055_change_relation/migration.sql b/prisma/migrations/20240611060055_change_relation/migration.sql deleted file mode 100644 index dc100a6..0000000 --- a/prisma/migrations/20240611060055_change_relation/migration.sql +++ /dev/null @@ -1,25 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `productGroupId` on the `Product` table. All the data in the column will be lost. - - Added the required column `productGroupId` to the `ProductType` table without a default value. This is not possible if the table is not empty. - - Added the required column `productId` to the `WorkProduct` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "Product" DROP CONSTRAINT "Product_productGroupId_fkey"; - --- AlterTable -ALTER TABLE "Product" DROP COLUMN "productGroupId"; - --- AlterTable -ALTER TABLE "ProductType" ADD COLUMN "productGroupId" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "WorkProduct" ADD COLUMN "productId" TEXT NOT NULL; - --- AddForeignKey -ALTER TABLE "WorkProduct" ADD CONSTRAINT "WorkProduct_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ProductType" ADD CONSTRAINT "ProductType_productGroupId_fkey" FOREIGN KEY ("productGroupId") REFERENCES "ProductGroup"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20240611081013_restructure_database/migration.sql b/prisma/migrations/20240611081013_restructure_database/migration.sql deleted file mode 100644 index 075d9b2..0000000 --- a/prisma/migrations/20240611081013_restructure_database/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ -/* - Warnings: - - - Added the required column `code` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "CustomerBranch" ADD COLUMN "code" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "Product" ADD COLUMN "attributes" JSONB; diff --git a/prisma/migrations/20240612042722_overhaul_service_table/migration.sql b/prisma/migrations/20240612042722_overhaul_service_table/migration.sql deleted file mode 100644 index 3549d90..0000000 --- a/prisma/migrations/20240612042722_overhaul_service_table/migration.sql +++ /dev/null @@ -1,36 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `serviceId` on the `Work` table. All the data in the column will be lost. - - Added the required column `order` to the `WorkProduct` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "Work" DROP CONSTRAINT "Work_serviceId_fkey"; - --- AlterTable -ALTER TABLE "Work" DROP COLUMN "serviceId"; - --- AlterTable -ALTER TABLE "WorkProduct" ADD COLUMN "order" INTEGER NOT NULL; - --- CreateTable -CREATE TABLE "WorkService" ( - "id" TEXT NOT NULL, - "order" INTEGER NOT NULL, - "workId" TEXT NOT NULL, - "serviceId" TEXT NOT NULL, - "createdBy" TEXT, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, - "updatedAt" TIMESTAMP(3) NOT NULL, - "productId" TEXT, - - CONSTRAINT "WorkService_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "WorkService" ADD CONSTRAINT "WorkService_workId_fkey" FOREIGN KEY ("workId") REFERENCES "Work"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "WorkService" ADD CONSTRAINT "WorkService_serviceId_fkey" FOREIGN KEY ("serviceId") REFERENCES "Service"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20240612045512_remove_order_from_work/migration.sql b/prisma/migrations/20240612045512_remove_order_from_work/migration.sql deleted file mode 100644 index 7255159..0000000 --- a/prisma/migrations/20240612045512_remove_order_from_work/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `order` on the `Work` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "Work" DROP COLUMN "order"; diff --git a/prisma/migrations/20240612065711_composite_key_m2m/migration.sql b/prisma/migrations/20240612065711_composite_key_m2m/migration.sql deleted file mode 100644 index 027089e..0000000 --- a/prisma/migrations/20240612065711_composite_key_m2m/migration.sql +++ /dev/null @@ -1,18 +0,0 @@ -/* - Warnings: - - - The primary key for the `WorkProduct` table will be changed. If it partially fails, the table could be left without primary key constraint. - - You are about to drop the column `id` on the `WorkProduct` table. All the data in the column will be lost. - - The primary key for the `WorkService` table will be changed. If it partially fails, the table could be left without primary key constraint. - - You are about to drop the column `id` on the `WorkService` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "WorkProduct" DROP CONSTRAINT "WorkProduct_pkey", -DROP COLUMN "id", -ADD CONSTRAINT "WorkProduct_pkey" PRIMARY KEY ("workId", "productId"); - --- AlterTable -ALTER TABLE "WorkService" DROP CONSTRAINT "WorkService_pkey", -DROP COLUMN "id", -ADD CONSTRAINT "WorkService_pkey" PRIMARY KEY ("workId", "serviceId"); diff --git a/prisma/migrations/20240612100121_update_field_to_optional/migration.sql b/prisma/migrations/20240612100121_update_field_to_optional/migration.sql deleted file mode 100644 index 72c9e76..0000000 --- a/prisma/migrations/20240612100121_update_field_to_optional/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ --- AlterTable -ALTER TABLE "Employee" ALTER COLUMN "address" DROP NOT NULL, -ALTER COLUMN "addressEN" DROP NOT NULL, -ALTER COLUMN "entryDate" DROP NOT NULL, -ALTER COLUMN "tm6Number" DROP NOT NULL, -ALTER COLUMN "visaExpiryDate" DROP NOT NULL, -ALTER COLUMN "visaIssueDate" DROP NOT NULL, -ALTER COLUMN "visaIssuingPlace" DROP NOT NULL, -ALTER COLUMN "visaNumber" DROP NOT NULL, -ALTER COLUMN "visaStayUntilDate" DROP NOT NULL, -ALTER COLUMN "visaType" DROP NOT NULL, -ALTER COLUMN "workerStatus" DROP NOT NULL; diff --git a/prisma/migrations/20240613084622_add_custom_attributes_json/migration.sql b/prisma/migrations/20240613084622_add_custom_attributes_json/migration.sql deleted file mode 100644 index cadf124..0000000 --- a/prisma/migrations/20240613084622_add_custom_attributes_json/migration.sql +++ /dev/null @@ -1,14 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `attributes` on the `Product` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "Product" DROP COLUMN "attributes"; - --- AlterTable -ALTER TABLE "Service" ADD COLUMN "attributes" JSONB; - --- AlterTable -ALTER TABLE "Work" ADD COLUMN "attributes" JSONB; diff --git a/prisma/migrations/20240614025514_remove_unintended_field/migration.sql b/prisma/migrations/20240614025514_remove_unintended_field/migration.sql deleted file mode 100644 index f97abe5..0000000 --- a/prisma/migrations/20240614025514_remove_unintended_field/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `productId` on the `WorkService` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "WorkService" DROP COLUMN "productId"; diff --git a/prisma/migrations/20240614084850_update_work_table/migration.sql b/prisma/migrations/20240614084850_update_work_table/migration.sql deleted file mode 100644 index fc91684..0000000 --- a/prisma/migrations/20240614084850_update_work_table/migration.sql +++ /dev/null @@ -1,22 +0,0 @@ -/* - 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; diff --git a/prisma/migrations/20240614095339_update_product_fields/migration.sql b/prisma/migrations/20240614095339_update_product_fields/migration.sql deleted file mode 100644 index 94cf800..0000000 --- a/prisma/migrations/20240614095339_update_product_fields/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - Changed the type of `process` on the `Product` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. - -*/ --- AlterTable -ALTER TABLE "Product" ADD COLUMN "remark" TEXT, -DROP COLUMN "process", -ADD COLUMN "process" INTEGER NOT NULL; diff --git a/prisma/migrations/20240617105818_add_field/migration.sql b/prisma/migrations/20240617105818_add_field/migration.sql deleted file mode 100644 index 0aa2292..0000000 --- a/prisma/migrations/20240617105818_add_field/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ -/* - Warnings: - - - Added the required column `personName` to the `Customer` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "Customer" ADD COLUMN "personName" TEXT NOT NULL, -ADD COLUMN "personNameEN" TEXT; diff --git a/prisma/migrations/20240624061417_add_order_status/migration.sql b/prisma/migrations/20240624061417_add_order_status/migration.sql deleted file mode 100644 index 436649e..0000000 --- a/prisma/migrations/20240624061417_add_order_status/migration.sql +++ /dev/null @@ -1,29 +0,0 @@ --- AlterTable -ALTER TABLE "Branch" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0; - --- AlterTable -ALTER TABLE "Customer" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0; - --- AlterTable -ALTER TABLE "CustomerBranch" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0; - --- AlterTable -ALTER TABLE "Employee" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0; - --- AlterTable -ALTER TABLE "Product" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0; - --- AlterTable -ALTER TABLE "ProductGroup" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0; - --- AlterTable -ALTER TABLE "ProductType" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0; - --- AlterTable -ALTER TABLE "Service" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0; - --- AlterTable -ALTER TABLE "User" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0; - --- AlterTable -ALTER TABLE "Work" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0; diff --git a/prisma/migrations/20240626042218_adjust_type/migration.sql b/prisma/migrations/20240626042218_adjust_type/migration.sql deleted file mode 100644 index 15fde59..0000000 --- a/prisma/migrations/20240626042218_adjust_type/migration.sql +++ /dev/null @@ -1,4 +0,0 @@ --- AlterTable -ALTER TABLE "Product" ALTER COLUMN "price" SET DATA TYPE DOUBLE PRECISION, -ALTER COLUMN "agentPrice" SET DATA TYPE DOUBLE PRECISION, -ALTER COLUMN "serviceCharge" SET DATA TYPE DOUBLE PRECISION; diff --git a/prisma/migrations/20240628020143_add_history_employee/migration.sql b/prisma/migrations/20240628020143_add_history_employee/migration.sql deleted file mode 100644 index b6840b8..0000000 --- a/prisma/migrations/20240628020143_add_history_employee/migration.sql +++ /dev/null @@ -1,14 +0,0 @@ --- CreateTable -CREATE TABLE "EmployeeHistory" ( - "id" TEXT NOT NULL, - "field" TEXT NOT NULL, - "valueBefore" JSONB NOT NULL, - "valueAfter" JSONB NOT NULL, - "timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "masterId" TEXT NOT NULL, - - CONSTRAINT "EmployeeHistory_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "EmployeeHistory" ADD CONSTRAINT "EmployeeHistory_masterId_fkey" FOREIGN KEY ("masterId") REFERENCES "Employee"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20240628023020_add_updated_by_user_field/migration.sql b/prisma/migrations/20240628023020_add_updated_by_user_field/migration.sql deleted file mode 100644 index 6ff205f..0000000 --- a/prisma/migrations/20240628023020_add_updated_by_user_field/migration.sql +++ /dev/null @@ -1,7 +0,0 @@ --- AlterTable -ALTER TABLE "EmployeeHistory" ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, -ADD COLUMN "updatedBy" TEXT, -ADD COLUMN "updatedByUserId" TEXT; - --- AddForeignKey -ALTER TABLE "EmployeeHistory" ADD CONSTRAINT "EmployeeHistory_updatedByUserId_fkey" FOREIGN KEY ("updatedByUserId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20240409061231_init/migration.sql b/prisma/migrations/20240628023502_init/migration.sql similarity index 60% rename from prisma/migrations/20240409061231_init/migration.sql rename to prisma/migrations/20240628023502_init/migration.sql index 9c0ad32..c8b655b 100644 --- a/prisma/migrations/20240409061231_init/migration.sql +++ b/prisma/migrations/20240628023502_init/migration.sql @@ -4,6 +4,103 @@ CREATE TYPE "Status" AS ENUM ('CREATED', 'ACTIVE', 'INACTIVE'); -- CreateEnum CREATE TYPE "UserType" AS ENUM ('USER', 'MESSENGER', 'DELEGATE', 'AGENCY'); +-- CreateEnum +CREATE TYPE "CustomerType" AS ENUM ('CORP', 'PERS'); + +-- CreateTable +CREATE TABLE "Menu" ( + "id" TEXT NOT NULL, + "caption" TEXT NOT NULL, + "captionEN" TEXT NOT NULL, + "menuType" TEXT NOT NULL, + "url" TEXT NOT NULL, + "createdBy" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedBy" TEXT, + "updatedAt" TIMESTAMP(3) NOT NULL, + "parentId" TEXT, + + CONSTRAINT "Menu_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "RoleMenuPermission" ( + "id" TEXT NOT NULL, + "userRole" TEXT NOT NULL, + "permission" TEXT NOT NULL, + "menuId" TEXT NOT NULL, + "createdBy" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedBy" TEXT, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "RoleMenuPermission_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "UserMenuPermission" ( + "id" TEXT NOT NULL, + "permission" TEXT NOT NULL, + "menuId" TEXT NOT NULL, + "userId" TEXT NOT NULL, + "createdBy" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedBy" TEXT, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "UserMenuPermission_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "MenuComponent" ( + "id" TEXT NOT NULL, + "componentId" TEXT NOT NULL, + "componentTag" TEXT NOT NULL, + "menuId" TEXT NOT NULL, + "createdBy" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedBy" TEXT, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "MenuComponent_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "RoleMenuComponentPermission" ( + "id" TEXT NOT NULL, + "userRole" TEXT NOT NULL, + "permission" TEXT NOT NULL, + "menuComponentId" TEXT NOT NULL, + "createdBy" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedBy" TEXT, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "RoleMenuComponentPermission_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "RunningNo" ( + "key" TEXT NOT NULL, + "value" INTEGER NOT NULL, + + CONSTRAINT "RunningNo_pkey" PRIMARY KEY ("key") +); + +-- CreateTable +CREATE TABLE "UserMenuComponentPermission" ( + "id" TEXT NOT NULL, + "userId" TEXT NOT NULL, + "menuComponentId" TEXT NOT NULL, + "permission" TEXT NOT NULL, + "createdBy" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedBy" TEXT, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "UserMenuComponentPermission_pkey" PRIMARY KEY ("id") +); + -- CreateTable CREATE TABLE "Province" ( "id" TEXT NOT NULL, @@ -11,7 +108,7 @@ CREATE TABLE "Province" ( "nameEN" TEXT NOT NULL, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "Province_pkey" PRIMARY KEY ("id") @@ -25,7 +122,7 @@ CREATE TABLE "District" ( "provinceId" TEXT NOT NULL, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "District_pkey" PRIMARY KEY ("id") @@ -40,7 +137,7 @@ CREATE TABLE "SubDistrict" ( "districtId" TEXT NOT NULL, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "SubDistrict_pkey" PRIMARY KEY ("id") @@ -55,20 +152,23 @@ CREATE TABLE "Branch" ( "nameEN" TEXT NOT NULL, "address" TEXT NOT NULL, "addressEN" TEXT NOT NULL, + "telephoneNo" TEXT NOT NULL, "provinceId" TEXT, "districtId" TEXT, "subDistrictId" TEXT, "zipCode" TEXT NOT NULL, "email" TEXT NOT NULL, - "telephoneNo" TEXT NOT NULL, + "contactName" TEXT, + "lineId" TEXT, "latitude" TEXT NOT NULL, "longitude" TEXT NOT NULL, "isHeadOffice" BOOLEAN NOT NULL DEFAULT false, "headOfficeId" TEXT, "status" "Status" NOT NULL DEFAULT 'CREATED', + "statusOrder" INTEGER NOT NULL DEFAULT 0, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "Branch_pkey" PRIMARY KEY ("id") @@ -78,11 +178,10 @@ CREATE TABLE "Branch" ( CREATE TABLE "BranchContact" ( "id" TEXT NOT NULL, "telephoneNo" TEXT NOT NULL, - "lineId" TEXT NOT NULL, "branchId" TEXT NOT NULL, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "BranchContact_pkey" PRIMARY KEY ("id") @@ -95,7 +194,7 @@ CREATE TABLE "BranchUser" ( "userId" TEXT NOT NULL, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "BranchUser_pkey" PRIMARY KEY ("id") @@ -104,12 +203,12 @@ CREATE TABLE "BranchUser" ( -- CreateTable CREATE TABLE "User" ( "id" TEXT NOT NULL, - "keycloakId" TEXT NOT NULL, "code" TEXT, "firstName" TEXT NOT NULL, "firstNameEN" TEXT NOT NULL, "lastName" TEXT NOT NULL, "lastNameEN" TEXT NOT NULL, + "username" TEXT NOT NULL, "gender" TEXT NOT NULL, "address" TEXT NOT NULL, "addressEN" TEXT NOT NULL, @@ -122,6 +221,8 @@ CREATE TABLE "User" ( "registrationNo" TEXT, "startDate" TIMESTAMP(3), "retireDate" TIMESTAMP(3), + "checkpoint" TEXT, + "checkpointEN" TEXT, "userType" "UserType" NOT NULL, "userRole" TEXT NOT NULL, "discountCondition" TEXT, @@ -131,10 +232,13 @@ CREATE TABLE "User" ( "sourceNationality" TEXT, "importNationality" TEXT, "trainingPlace" TEXT, + "responsibleArea" TEXT, + "birthDate" TIMESTAMP(3), "status" "Status" NOT NULL DEFAULT 'CREATED', + "statusOrder" INTEGER NOT NULL DEFAULT 0, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "User_pkey" PRIMARY KEY ("id") @@ -144,14 +248,17 @@ CREATE TABLE "User" ( CREATE TABLE "Customer" ( "id" TEXT NOT NULL, "code" TEXT NOT NULL, - "customerType" TEXT NOT NULL, + "personName" TEXT NOT NULL, + "personNameEN" TEXT, + "customerType" "CustomerType" NOT NULL, "customerName" TEXT NOT NULL, "customerNameEN" TEXT NOT NULL, - "imageUrl" TEXT, + "taxNo" TEXT, "status" "Status" NOT NULL DEFAULT 'CREATED', + "statusOrder" INTEGER NOT NULL DEFAULT 0, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "Customer_pkey" PRIMARY KEY ("id") @@ -160,12 +267,13 @@ CREATE TABLE "Customer" ( -- CreateTable CREATE TABLE "CustomerBranch" ( "id" TEXT NOT NULL, - "branchNo" TEXT NOT NULL, + "branchNo" INTEGER NOT NULL, + "code" TEXT NOT NULL, "legalPersonNo" TEXT NOT NULL, "name" TEXT NOT NULL, "nameEN" TEXT NOT NULL, "customerId" TEXT NOT NULL, - "taxNo" TEXT NOT NULL, + "taxNo" TEXT, "registerName" TEXT NOT NULL, "registerDate" TIMESTAMP(3) NOT NULL, "authorizedCapital" TEXT NOT NULL, @@ -177,12 +285,20 @@ CREATE TABLE "CustomerBranch" ( "zipCode" TEXT NOT NULL, "email" TEXT NOT NULL, "telephoneNo" TEXT NOT NULL, - "latitude" TEXT NOT NULL, - "longitude" TEXT NOT NULL, + "employmentOffice" TEXT NOT NULL, + "bussinessType" TEXT NOT NULL, + "bussinessTypeEN" TEXT NOT NULL, + "jobPosition" TEXT NOT NULL, + "jobPositionEN" TEXT NOT NULL, + "jobDescription" TEXT NOT NULL, + "saleEmployee" TEXT NOT NULL, + "payDate" TIMESTAMP(3) NOT NULL, + "wageRate" INTEGER NOT NULL, "status" "Status" NOT NULL DEFAULT 'CREATED', + "statusOrder" INTEGER NOT NULL DEFAULT 0, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "CustomerBranch_pkey" PRIMARY KEY ("id") @@ -200,42 +316,70 @@ CREATE TABLE "Employee" ( "dateOfBirth" TIMESTAMP(3) NOT NULL, "gender" TEXT NOT NULL, "nationality" TEXT NOT NULL, - "address" TEXT NOT NULL, - "addressEN" TEXT NOT NULL, + "address" TEXT, + "addressEN" TEXT, "provinceId" TEXT, "districtId" TEXT, "subDistrictId" TEXT, "zipCode" TEXT NOT NULL, - "email" TEXT NOT NULL, - "telephoneNo" TEXT NOT NULL, - "arrivalBarricade" TEXT NOT NULL, - "arrivalCardNo" TEXT NOT NULL, + "passportType" TEXT NOT NULL, + "passportNumber" TEXT NOT NULL, + "passportIssueDate" TIMESTAMP(3) NOT NULL, + "passportExpiryDate" TIMESTAMP(3) NOT NULL, + "passportIssuingCountry" TEXT NOT NULL, + "passportIssuingPlace" TEXT NOT NULL, + "previousPassportReference" TEXT, + "visaType" TEXT, + "visaNumber" TEXT, + "visaIssueDate" TIMESTAMP(3), + "visaExpiryDate" TIMESTAMP(3), + "visaIssuingPlace" TEXT, + "visaStayUntilDate" TIMESTAMP(3), + "tm6Number" TEXT, + "entryDate" TIMESTAMP(3), + "workerStatus" TEXT, "customerBranchId" TEXT, "status" "Status" NOT NULL DEFAULT 'CREATED', + "statusOrder" INTEGER NOT NULL DEFAULT 0, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "Employee_pkey" PRIMARY KEY ("id") ); +-- CreateTable +CREATE TABLE "EmployeeHistory" ( + "id" TEXT NOT NULL, + "field" TEXT NOT NULL, + "valueBefore" JSONB NOT NULL, + "valueAfter" JSONB NOT NULL, + "timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedByUserId" TEXT, + "updatedBy" TEXT, + "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "masterId" TEXT NOT NULL, + + CONSTRAINT "EmployeeHistory_pkey" PRIMARY KEY ("id") +); + -- CreateTable CREATE TABLE "EmployeeCheckup" ( "id" TEXT NOT NULL, "employeeId" TEXT NOT NULL, - "checkupResult" TEXT NOT NULL, - "checkupType" TEXT NOT NULL, + "checkupResult" TEXT, + "checkupType" TEXT, "provinceId" TEXT, - "hospitalName" TEXT NOT NULL, - "remark" TEXT NOT NULL, - "medicalBenefitScheme" TEXT NOT NULL, - "insuranceCompany" TEXT NOT NULL, - "coverageStartDate" TIMESTAMP(3) NOT NULL, - "coverageExpireDate" TIMESTAMP(3) NOT NULL, + "hospitalName" TEXT, + "remark" TEXT, + "medicalBenefitScheme" TEXT, + "insuranceCompany" TEXT, + "coverageStartDate" TIMESTAMP(3), + "coverageExpireDate" TIMESTAMP(3), "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "EmployeeCheckup_pkey" PRIMARY KEY ("id") @@ -245,17 +389,18 @@ CREATE TABLE "EmployeeCheckup" ( CREATE TABLE "EmployeeWork" ( "id" TEXT NOT NULL, "employeeId" TEXT NOT NULL, - "ownerName" TEXT NOT NULL, - "positionName" TEXT NOT NULL, - "jobType" TEXT NOT NULL, - "workplace" TEXT NOT NULL, - "workPermitNo" TEXT NOT NULL, - "workPermitIssuDate" TIMESTAMP(3) NOT NULL, - "workPermitExpireDate" TIMESTAMP(3) NOT NULL, - "workEndDate" TIMESTAMP(3) NOT NULL, + "ownerName" TEXT, + "positionName" TEXT, + "jobType" TEXT, + "workplace" TEXT, + "workPermitNo" TEXT, + "workPermitIssuDate" TIMESTAMP(3), + "workPermitExpireDate" TIMESTAMP(3), + "workEndDate" TIMESTAMP(3), + "remark" TEXT, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "EmployeeWork_pkey" PRIMARY KEY ("id") @@ -265,13 +410,20 @@ CREATE TABLE "EmployeeWork" ( CREATE TABLE "EmployeeOtherInfo" ( "id" TEXT NOT NULL, "employeeId" TEXT NOT NULL, - "citizenId" TEXT NOT NULL, - "fatherFullName" TEXT NOT NULL, - "motherFullName" TEXT NOT NULL, - "birthPlace" TEXT NOT NULL, + "citizenId" TEXT, + "fatherBirthPlace" TEXT, + "fatherFirstName" TEXT, + "fatherLastName" TEXT, + "motherBirthPlace" TEXT, + "motherFirstName" TEXT, + "motherLastName" TEXT, + "fatherFirstNameEN" TEXT, + "fatherLastNameEN" TEXT, + "motherFirstNameEN" TEXT, + "motherLastNameEN" TEXT, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "EmployeeOtherInfo_pkey" PRIMARY KEY ("id") @@ -283,10 +435,12 @@ CREATE TABLE "Service" ( "code" TEXT NOT NULL, "name" TEXT NOT NULL, "detail" TEXT NOT NULL, + "attributes" JSONB, "status" "Status" NOT NULL DEFAULT 'CREATED', + "statusOrder" INTEGER NOT NULL DEFAULT 0, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "Service_pkey" PRIMARY KEY ("id") @@ -297,11 +451,13 @@ CREATE TABLE "Work" ( "id" TEXT NOT NULL, "order" INTEGER NOT NULL, "name" TEXT NOT NULL, - "serviceId" TEXT NOT NULL, + "attributes" JSONB, "status" "Status" NOT NULL DEFAULT 'CREATED', + "statusOrder" INTEGER NOT NULL DEFAULT 0, + "serviceId" TEXT, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "Work_pkey" PRIMARY KEY ("id") @@ -309,14 +465,15 @@ CREATE TABLE "Work" ( -- CreateTable CREATE TABLE "WorkProduct" ( - "id" TEXT NOT NULL, + "order" INTEGER NOT NULL, "workId" TEXT NOT NULL, + "productId" TEXT NOT NULL, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, - CONSTRAINT "WorkProduct_pkey" PRIMARY KEY ("id") + CONSTRAINT "WorkProduct_pkey" PRIMARY KEY ("workId","productId") ); -- CreateTable @@ -327,9 +484,10 @@ CREATE TABLE "ProductGroup" ( "detail" TEXT NOT NULL, "remark" TEXT NOT NULL, "status" "Status" NOT NULL DEFAULT 'CREATED', + "statusOrder" INTEGER NOT NULL DEFAULT 0, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "ProductGroup_pkey" PRIMARY KEY ("id") @@ -343,10 +501,12 @@ CREATE TABLE "ProductType" ( "detail" TEXT NOT NULL, "remark" TEXT NOT NULL, "status" "Status" NOT NULL DEFAULT 'CREATED', + "statusOrder" INTEGER NOT NULL DEFAULT 0, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, + "productGroupId" TEXT NOT NULL, CONSTRAINT "ProductType_pkey" PRIMARY KEY ("id") ); @@ -357,22 +517,49 @@ CREATE TABLE "Product" ( "code" TEXT NOT NULL, "name" TEXT NOT NULL, "detail" TEXT NOT NULL, - "process" TEXT NOT NULL, - "price" INTEGER NOT NULL, - "agentPrice" INTEGER NOT NULL, - "serviceCharge" INTEGER NOT NULL, - "imageUrl" TEXT NOT NULL, + "process" INTEGER NOT NULL, + "price" DOUBLE PRECISION NOT NULL, + "agentPrice" DOUBLE PRECISION NOT NULL, + "serviceCharge" DOUBLE PRECISION NOT NULL, "status" "Status" NOT NULL DEFAULT 'CREATED', + "statusOrder" INTEGER NOT NULL DEFAULT 0, + "remark" TEXT, "productTypeId" TEXT, - "productGroupId" TEXT, "createdBy" TEXT, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updateBy" TEXT, + "updatedBy" TEXT, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "Product_pkey" PRIMARY KEY ("id") ); +-- CreateIndex +CREATE UNIQUE INDEX "RunningNo_key_key" ON "RunningNo"("key"); + +-- AddForeignKey +ALTER TABLE "Menu" ADD CONSTRAINT "Menu_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "Menu"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "RoleMenuPermission" ADD CONSTRAINT "RoleMenuPermission_menuId_fkey" FOREIGN KEY ("menuId") REFERENCES "Menu"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "UserMenuPermission" ADD CONSTRAINT "UserMenuPermission_menuId_fkey" FOREIGN KEY ("menuId") REFERENCES "Menu"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "UserMenuPermission" ADD CONSTRAINT "UserMenuPermission_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "MenuComponent" ADD CONSTRAINT "MenuComponent_menuId_fkey" FOREIGN KEY ("menuId") REFERENCES "Menu"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "RoleMenuComponentPermission" ADD CONSTRAINT "RoleMenuComponentPermission_menuComponentId_fkey" FOREIGN KEY ("menuComponentId") REFERENCES "MenuComponent"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "UserMenuComponentPermission" ADD CONSTRAINT "UserMenuComponentPermission_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "UserMenuComponentPermission" ADD CONSTRAINT "UserMenuComponentPermission_menuComponentId_fkey" FOREIGN KEY ("menuComponentId") REFERENCES "MenuComponent"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + -- AddForeignKey ALTER TABLE "District" ADD CONSTRAINT "District_provinceId_fkey" FOREIGN KEY ("provinceId") REFERENCES "Province"("id") ON DELETE CASCADE ON UPDATE CASCADE; @@ -433,6 +620,12 @@ ALTER TABLE "Employee" ADD CONSTRAINT "Employee_subDistrictId_fkey" FOREIGN KEY -- AddForeignKey ALTER TABLE "Employee" ADD CONSTRAINT "Employee_customerBranchId_fkey" FOREIGN KEY ("customerBranchId") REFERENCES "CustomerBranch"("id") ON DELETE SET NULL ON UPDATE CASCADE; +-- AddForeignKey +ALTER TABLE "EmployeeHistory" ADD CONSTRAINT "EmployeeHistory_updatedByUserId_fkey" FOREIGN KEY ("updatedByUserId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "EmployeeHistory" ADD CONSTRAINT "EmployeeHistory_masterId_fkey" FOREIGN KEY ("masterId") REFERENCES "Employee"("id") ON DELETE CASCADE ON UPDATE CASCADE; + -- AddForeignKey ALTER TABLE "EmployeeCheckup" ADD CONSTRAINT "EmployeeCheckup_employeeId_fkey" FOREIGN KEY ("employeeId") REFERENCES "Employee"("id") ON DELETE CASCADE ON UPDATE CASCADE; @@ -452,7 +645,10 @@ ALTER TABLE "Work" ADD CONSTRAINT "Work_serviceId_fkey" FOREIGN KEY ("serviceId" ALTER TABLE "WorkProduct" ADD CONSTRAINT "WorkProduct_workId_fkey" FOREIGN KEY ("workId") REFERENCES "Work"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey -ALTER TABLE "Product" ADD CONSTRAINT "Product_productTypeId_fkey" FOREIGN KEY ("productTypeId") REFERENCES "ProductType"("id") ON DELETE SET NULL ON UPDATE CASCADE; +ALTER TABLE "WorkProduct" ADD CONSTRAINT "WorkProduct_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey -ALTER TABLE "Product" ADD CONSTRAINT "Product_productGroupId_fkey" FOREIGN KEY ("productGroupId") REFERENCES "ProductGroup"("id") ON DELETE SET NULL ON UPDATE CASCADE; +ALTER TABLE "ProductType" ADD CONSTRAINT "ProductType_productGroupId_fkey" FOREIGN KEY ("productGroupId") REFERENCES "ProductGroup"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Product" ADD CONSTRAINT "Product_productTypeId_fkey" FOREIGN KEY ("productTypeId") REFERENCES "ProductType"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 2a3caac..3912749 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -22,7 +22,7 @@ model Menu { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt parent Menu? @relation(name: "MenuRelation", fields: [parentId], references: [id]) @@ -45,7 +45,7 @@ model RoleMenuPermission { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt } @@ -62,7 +62,7 @@ model UserMenuPermission { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt } @@ -77,7 +77,7 @@ model MenuComponent { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt roleMenuComponentPermission RoleMenuComponentPermission[] userMennuComponentPermission UserMenuComponentPermission[] @@ -94,7 +94,7 @@ model RoleMenuComponentPermission { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt } @@ -116,7 +116,7 @@ model UserMenuComponentPermission { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt } @@ -127,7 +127,7 @@ model Province { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt district District[] @@ -148,7 +148,7 @@ model District { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt subDistrict SubDistrict[] @@ -169,7 +169,7 @@ model SubDistrict { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt branch Branch[] @@ -222,7 +222,7 @@ model Branch { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt branch Branch[] @relation(name: "HeadOfficeRelation") @@ -239,7 +239,7 @@ model BranchContact { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt } @@ -254,7 +254,7 @@ model BranchUser { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt } @@ -323,7 +323,7 @@ model User { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt branch BranchUser[] @@ -352,7 +352,7 @@ model Customer { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt branch CustomerBranch[] @@ -407,7 +407,7 @@ model CustomerBranch { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt employee Employee[] @@ -467,7 +467,7 @@ model Employee { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt employeeCheckup EmployeeCheckup[] @@ -515,7 +515,7 @@ model EmployeeCheckup { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt } @@ -537,7 +537,7 @@ model EmployeeWork { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt } @@ -562,7 +562,7 @@ model EmployeeOtherInfo { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt } @@ -581,7 +581,7 @@ model Service { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt } @@ -600,7 +600,7 @@ model Work { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt productOnWork WorkProduct[] @@ -615,7 +615,7 @@ model WorkProduct { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt @@id([workId, productId]) @@ -634,7 +634,7 @@ model ProductGroup { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt type ProductType[] @@ -653,7 +653,7 @@ model ProductType { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt productGroup ProductGroup @relation(fields: [productGroupId], references: [id], onDelete: Cascade) @@ -685,6 +685,6 @@ model Product { createdBy String? createdAt DateTime @default(now()) - updateBy String? + updatedBy String? updatedAt DateTime @updatedAt } diff --git a/src/controllers/branch-contact-controller.ts b/src/controllers/branch-contact-controller.ts index 701e4b3..d98c966 100644 --- a/src/controllers/branch-contact-controller.ts +++ b/src/controllers/branch-contact-controller.ts @@ -79,7 +79,7 @@ export class BranchContactController extends Controller { throw new HttpError(HttpStatus.BAD_REQUEST, "Branch cannot be found.", "branchBadReq"); } const record = await prisma.branchContact.create({ - data: { ...body, branchId, createdBy: req.user.name, updateBy: req.user.name }, + data: { ...body, branchId, createdBy: req.user.name, updatedBy: req.user.name }, }); this.setStatus(HttpStatus.CREATED); @@ -107,7 +107,7 @@ export class BranchContactController extends Controller { } const record = await prisma.branchContact.update({ - data: { ...body, updateBy: req.user.name }, + data: { ...body, updatedBy: req.user.name }, where: { id: contactId, branchId }, }); diff --git a/src/controllers/branch-controller.ts b/src/controllers/branch-controller.ts index 8008edb..50bce01 100644 --- a/src/controllers/branch-controller.ts +++ b/src/controllers/branch-controller.ts @@ -287,7 +287,7 @@ export class BranchController extends Controller { subDistrict: { connect: subDistrictId ? { id: subDistrictId } : undefined }, headOffice: { connect: headOfficeId ? { id: headOfficeId } : undefined }, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); }, @@ -403,7 +403,7 @@ export class BranchController extends Controller { connect: headOfficeId ? { id: headOfficeId } : undefined, disconnect: headOfficeId === null || undefined, }, - updateBy: req.user.name, + updatedBy: req.user.name, }, where: { id: branchId }, }); diff --git a/src/controllers/branch-user-controller.ts b/src/controllers/branch-user-controller.ts index 539dd2e..7dfed95 100644 --- a/src/controllers/branch-user-controller.ts +++ b/src/controllers/branch-user-controller.ts @@ -140,7 +140,7 @@ export class BranchUserController extends Controller { branchId, userId: v.id, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, })), }), ]); @@ -250,7 +250,7 @@ export class UserBranchController extends Controller { branchId: v.id, userId, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, })), }); diff --git a/src/controllers/customer-branch-controller.ts b/src/controllers/customer-branch-controller.ts index ff7eac6..d07d7b4 100644 --- a/src/controllers/customer-branch-controller.ts +++ b/src/controllers/customer-branch-controller.ts @@ -295,7 +295,7 @@ export class CustomerBranchController extends Controller { district: { connect: districtId ? { id: districtId } : undefined }, subDistrict: { connect: subDistrictId ? { id: subDistrictId } : undefined }, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); }, @@ -381,7 +381,7 @@ export class CustomerBranchController extends Controller { disconnect: subDistrictId === null || undefined, }, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); diff --git a/src/controllers/customer-controller.ts b/src/controllers/customer-controller.ts index 6b712cc..23b1e8d 100644 --- a/src/controllers/customer-controller.ts +++ b/src/controllers/customer-controller.ts @@ -306,12 +306,12 @@ export class CustomerController extends Controller { branchNo: i + 1, code: `${last.key.slice(9)}${last.value.toString().padStart(6, "0")}-${(i + 1).toString().padStart(2, "0")}`, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, })) || [], }, }, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); }, @@ -437,19 +437,19 @@ export class CustomerController extends Controller { branchNo: i + 1, code: `${customer.code}-${(i + 1).toString().padStart(2, "0")}`, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, id: undefined, }, update: { ...v, branchNo: i + 1, code: `${customer.code}-${(i + 1).toString().padStart(2, "0")}`, - updateBy: req.user.name, + updatedBy: req.user.name, }, })), }) || undefined, - updateBy: req.user.name, + updatedBy: req.user.name, }, }) .then((v) => { diff --git a/src/controllers/employee-checkup-controller.ts b/src/controllers/employee-checkup-controller.ts index 07bf28c..21fb896 100644 --- a/src/controllers/employee-checkup-controller.ts +++ b/src/controllers/employee-checkup-controller.ts @@ -91,7 +91,7 @@ export class EmployeeCheckupController extends Controller { province: { connect: provinceId ? { id: provinceId } : undefined }, employee: { connect: { id: employeeId } }, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); @@ -143,7 +143,7 @@ export class EmployeeCheckupController extends Controller { ...rest, province: { connect: provinceId ? { id: provinceId } : undefined }, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); diff --git a/src/controllers/employee-controller.ts b/src/controllers/employee-controller.ts index abd7c83..2845ae2 100644 --- a/src/controllers/employee-controller.ts +++ b/src/controllers/employee-controller.ts @@ -419,7 +419,7 @@ export class EmployeeController extends Controller { subDistrict: { connect: subDistrictId ? { id: subDistrictId } : undefined }, customerBranch: { connect: { id: customerBranchId } }, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); }, @@ -578,12 +578,12 @@ export class EmployeeController extends Controller { create: { ...v, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, id: undefined, }, update: { ...v, - updateBy: req.user.name, + updatedBy: req.user.name, }, })), } @@ -601,12 +601,12 @@ export class EmployeeController extends Controller { create: { ...v, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, id: undefined, }, update: { ...v, - updateBy: req.user.name, + updatedBy: req.user.name, }, })), } @@ -630,7 +630,7 @@ export class EmployeeController extends Controller { disconnect: subDistrictId === null || undefined, }, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); }); diff --git a/src/controllers/employee-other-info-controller.ts b/src/controllers/employee-other-info-controller.ts index 4a2afd3..a479de7 100644 --- a/src/controllers/employee-other-info-controller.ts +++ b/src/controllers/employee-other-info-controller.ts @@ -62,7 +62,7 @@ export class EmployeeOtherInfo extends Controller { ...body, employee: { connect: { id: employeeId } }, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); @@ -88,7 +88,7 @@ export class EmployeeOtherInfo extends Controller { const record = await prisma.employeeOtherInfo.update({ where: { id: otherInfoId, employeeId }, - data: { ...body, createdBy: req.user.name, updateBy: req.user.name }, + data: { ...body, createdBy: req.user.name, updatedBy: req.user.name }, }); this.setStatus(HttpStatus.CREATED); diff --git a/src/controllers/employee-work-controller.ts b/src/controllers/employee-work-controller.ts index 2336874..85c12f4 100644 --- a/src/controllers/employee-work-controller.ts +++ b/src/controllers/employee-work-controller.ts @@ -69,7 +69,7 @@ export class EmployeeWorkController extends Controller { ...body, employee: { connect: { id: employeeId } }, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); @@ -91,7 +91,7 @@ export class EmployeeWorkController extends Controller { const record = await prisma.employeeWork.update({ where: { id: workId, employeeId }, - data: { ...body, createdBy: req.user.name, updateBy: req.user.name }, + data: { ...body, createdBy: req.user.name, updatedBy: req.user.name }, }); this.setStatus(HttpStatus.CREATED); diff --git a/src/controllers/product-service-controller.ts b/src/controllers/product-service-controller.ts index 95bb9ff..8671c3d 100644 --- a/src/controllers/product-service-controller.ts +++ b/src/controllers/product-service-controller.ts @@ -29,7 +29,7 @@ export class ProductServiceController extends Controller { "productTypeId", "createdBy", "createdAt", - "updateBy", + "updatedBy", "updatedAt", 'product' as "type" FROM "Product" @@ -49,7 +49,7 @@ export class ProductServiceController extends Controller { null as "productTypeId", "createdBy", "createdAt", - "updateBy", + "updatedBy", "updatedAt", 'service' as "type" FROM "Service" diff --git a/src/controllers/product/group-controller.ts b/src/controllers/product/group-controller.ts index 61937cf..12ef7c5 100644 --- a/src/controllers/product/group-controller.ts +++ b/src/controllers/product/group-controller.ts @@ -114,7 +114,7 @@ export class ProductGroup extends Controller { statusOrder: +(body.status === "INACTIVE"), code: `G${last.value.toString().padStart(2, "0")}`, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); }, @@ -141,7 +141,7 @@ export class ProductGroup extends Controller { } const record = await prisma.productGroup.update({ - data: { ...body, statusOrder: +(body.status === "INACTIVE"), updateBy: req.user.name }, + data: { ...body, statusOrder: +(body.status === "INACTIVE"), updatedBy: req.user.name }, where: { id: groupId }, }); diff --git a/src/controllers/product/product-controller.ts b/src/controllers/product/product-controller.ts index 79bf0da..340ab9f 100644 --- a/src/controllers/product/product-controller.ts +++ b/src/controllers/product/product-controller.ts @@ -174,7 +174,7 @@ export class ProductController extends Controller { statusOrder: +(body.status === "INACTIVE"), code: `${body.code.toLocaleUpperCase()}${last.value.toString().padStart(3, "0")}`, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); }, @@ -230,7 +230,7 @@ export class ProductController extends Controller { } const record = await prisma.product.update({ - data: { ...body, statusOrder: +(body.status === "INACTIVE"), updateBy: req.user.name }, + data: { ...body, statusOrder: +(body.status === "INACTIVE"), updatedBy: req.user.name }, where: { id: productId }, }); diff --git a/src/controllers/product/type-controller.ts b/src/controllers/product/type-controller.ts index 4945deb..4739130 100644 --- a/src/controllers/product/type-controller.ts +++ b/src/controllers/product/type-controller.ts @@ -128,7 +128,7 @@ export class ProductType extends Controller { statusOrder: +(body.status === "INACTIVE"), code: `T${productGroup.code}${last.value.toString().padStart(2, "0")}`, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); }, @@ -173,7 +173,7 @@ export class ProductType extends Controller { } const record = await prisma.productType.update({ - data: { ...body, statusOrder: +(body.status === "INACTIVE"), updateBy: req.user.name }, + data: { ...body, statusOrder: +(body.status === "INACTIVE"), updatedBy: req.user.name }, where: { id: typeId }, }); diff --git a/src/controllers/service/service-controller.ts b/src/controllers/service/service-controller.ts index 171869f..a565620 100644 --- a/src/controllers/service/service-controller.ts +++ b/src/controllers/service/service-controller.ts @@ -246,7 +246,7 @@ export class ServiceController extends Controller { code: `${body.code.toLocaleUpperCase()}${last.value.toString().padStart(3, "0")}`, work: { connect: workList.map((v) => ({ id: v.id })) }, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); }, @@ -308,7 +308,7 @@ export class ServiceController extends Controller { deleteMany: {}, connect: workList.map((v) => ({ id: v.id })), }, - updateBy: req.user.name, + updatedBy: req.user.name, }, where: { id: serviceId }, }); diff --git a/src/controllers/user-controller.ts b/src/controllers/user-controller.ts index db756fb..9f88d73 100644 --- a/src/controllers/user-controller.ts +++ b/src/controllers/user-controller.ts @@ -298,7 +298,7 @@ export class UserController extends Controller { district: { connect: districtId ? { id: districtId } : undefined }, subDistrict: { connect: subDistrictId ? { id: subDistrictId } : undefined }, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); @@ -438,7 +438,7 @@ export class UserController extends Controller { connect: subDistrictId ? { id: subDistrictId } : undefined, disconnect: subDistrictId === null || undefined, }, - updateBy: req.user.name, + updatedBy: req.user.name, }, where: { id: userId }, }); diff --git a/src/controllers/work/work-controller.ts b/src/controllers/work/work-controller.ts index 547f8a8..24577b7 100644 --- a/src/controllers/work/work-controller.ts +++ b/src/controllers/work/work-controller.ts @@ -184,12 +184,12 @@ export class WorkController extends Controller { order: i + 1, productId: v, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, })), }, }, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, }); @@ -282,12 +282,12 @@ export class WorkController extends Controller { order: i + 1, productId: v, createdBy: req.user.name, - updateBy: req.user.name, + updatedBy: req.user.name, }, })), } : undefined, - updateBy: req.user.name, + updatedBy: req.user.name, }, });