Files
quicklanch-server/prisma/migrations/20260406143513_add_plan_schema/migration.sql
T

30 lines
931 B
SQL
Raw Normal View History

2026-04-07 22:32:13 +06:00
/*
Warnings:
- Added the required column `subscriptionId` to the `Account` table without a default value. This is not possible if the table is not empty.
*/
-- CreateEnum
CREATE TYPE "PType" AS ENUM ('FREE', 'STANDARD', 'PRO');
-- AlterTable
ALTER TABLE "Account" ADD COLUMN "isSubscribe" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "subscriptionId" TEXT NOT NULL;
-- CreateTable
CREATE TABLE "Plan" (
"id" TEXT NOT NULL,
"planName" TEXT NOT NULL,
"price" INTEGER NOT NULL,
"planType" "PType" NOT NULL,
"planDesc" TEXT NOT NULL,
"planFeatures" JSONB NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Plan_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "Account" ADD CONSTRAINT "Account_subscriptionId_fkey" FOREIGN KEY ("subscriptionId") REFERENCES "Plan"("id") ON DELETE RESTRICT ON UPDATE CASCADE;