pelagia-portal/App/prisma/migrations/20260514191638_vendor_contacts/migration.sql
2026-05-18 23:18:58 +05:30

29 lines
1,019 B
SQL

/*
Warnings:
- You are about to drop the column `contactEmail` on the `Vendor` table. All the data in the column will be lost.
- You are about to drop the column `contactMobile` on the `Vendor` table. All the data in the column will be lost.
- You are about to drop the column `contactName` on the `Vendor` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Vendor" DROP COLUMN "contactEmail",
DROP COLUMN "contactMobile",
DROP COLUMN "contactName";
-- CreateTable
CREATE TABLE "VendorContact" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"role" TEXT,
"mobile" TEXT,
"email" TEXT,
"isPrimary" BOOLEAN NOT NULL DEFAULT false,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"vendorId" TEXT NOT NULL,
CONSTRAINT "VendorContact_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "VendorContact" ADD CONSTRAINT "VendorContact_vendorId_fkey" FOREIGN KEY ("vendorId") REFERENCES "Vendor"("id") ON DELETE CASCADE ON UPDATE CASCADE;