feat: refactor permission product service
This commit is contained in:
parent
f9cc39522c
commit
8c0932f6d8
4 changed files with 189 additions and 292 deletions
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `registeredBranchId` on the `Product` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `registeredBranchId` on the `Service` table. All the data in the column will be lost.
|
||||
- Made the column `productGroupId` on table `Product` required. This step will fail if there are existing NULL values in that column.
|
||||
- Made the column `registeredBranchId` on table `ProductGroup` required. This step will fail if there are existing NULL values in that column.
|
||||
- Made the column `productGroupId` on table `Service` required. This step will fail if there are existing NULL values in that column.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Product" DROP CONSTRAINT "Product_productGroupId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Product" DROP CONSTRAINT "Product_registeredBranchId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "ProductGroup" DROP CONSTRAINT "ProductGroup_registeredBranchId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Service" DROP CONSTRAINT "Service_productGroupId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Service" DROP CONSTRAINT "Service_registeredBranchId_fkey";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Product" DROP COLUMN "registeredBranchId",
|
||||
ADD COLUMN "shared" BOOLEAN NOT NULL DEFAULT false,
|
||||
ALTER COLUMN "productGroupId" SET NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "ProductGroup" ALTER COLUMN "registeredBranchId" SET NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Service" DROP COLUMN "registeredBranchId",
|
||||
ADD COLUMN "shared" BOOLEAN NOT NULL DEFAULT false,
|
||||
ALTER COLUMN "productGroupId" SET NOT NULL;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "ProductGroup" ADD CONSTRAINT "ProductGroup_registeredBranchId_fkey" FOREIGN KEY ("registeredBranchId") REFERENCES "Branch"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Product" ADD CONSTRAINT "Product_productGroupId_fkey" FOREIGN KEY ("productGroupId") REFERENCES "ProductGroup"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Service" ADD CONSTRAINT "Service_productGroupId_fkey" FOREIGN KEY ("productGroupId") REFERENCES "ProductGroup"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
Loading…
Add table
Add a link
Reference in a new issue