chore: update migration

This commit is contained in:
Methapon Metanipat 2024-09-06 11:56:37 +07:00
parent e63510850b
commit b5d59ff276
2 changed files with 26 additions and 2 deletions

View file

@ -0,0 +1,20 @@
/*
Warnings:
- Made the column `customerBranchId` on table `Employee` required. This step will fail if there are existing NULL values in that column.
*/
-- DropForeignKey
ALTER TABLE "Employee" DROP CONSTRAINT "Employee_customerBranchId_fkey";
-- AlterTable
ALTER TABLE "Employee" ALTER COLUMN "customerBranchId" SET NOT NULL;
-- AlterTable
ALTER TABLE "ProductGroup" ADD COLUMN "registeredBranchId" TEXT;
-- AddForeignKey
ALTER TABLE "Employee" ADD CONSTRAINT "Employee_customerBranchId_fkey" FOREIGN KEY ("customerBranchId") REFERENCES "CustomerBranch"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ProductGroup" ADD CONSTRAINT "ProductGroup_registeredBranchId_fkey" FOREIGN KEY ("registeredBranchId") REFERENCES "Branch"("id") ON DELETE SET NULL ON UPDATE CASCADE;