adding the plan post api
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
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;
|
||||
@@ -0,0 +1,8 @@
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Account" DROP CONSTRAINT "Account_subscriptionId_fkey";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Account" ALTER COLUMN "subscriptionId" DROP NOT NULL;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Account" ADD CONSTRAINT "Account_subscriptionId_fkey" FOREIGN KEY ("subscriptionId") REFERENCES "Plan"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -12,6 +12,9 @@ model Account {
|
||||
lastOtpSendingTime DateTime?
|
||||
isDeleted Boolean @default(false)
|
||||
isAccountVerified Boolean @default(false)
|
||||
isSubscribe Boolean @default(false)
|
||||
subscriptionId String?
|
||||
plan Plan? @relation(fields: [subscriptionId], references: [id])
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now())
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
enum PType {
|
||||
FREE
|
||||
STANDARD
|
||||
PRO
|
||||
}
|
||||
|
||||
model Plan {
|
||||
id String @id @default(uuid())
|
||||
planName String
|
||||
price Int
|
||||
planType PType
|
||||
planDesc String
|
||||
planFeatures Json
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
account Account[]
|
||||
}
|
||||
Reference in New Issue
Block a user