2
0

(billing) Implement custom plan

This commit is contained in:
Baptiste Arnaud
2022-10-27 11:32:21 +02:00
committed by Baptiste Arnaud
parent 3f7dc79918
commit 385853ca3c
23 changed files with 395 additions and 68 deletions

View File

@ -0,0 +1,30 @@
-- AlterEnum
ALTER TYPE "Plan" ADD VALUE 'CUSTOM';
-- AlterTable
ALTER TABLE "Workspace" ADD COLUMN "customChatsLimit" INTEGER,
ADD COLUMN "customSeatsLimit" INTEGER,
ADD COLUMN "customStorageLimit" INTEGER;
-- CreateTable
CREATE TABLE "ClaimableCustomPlan" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"claimedAt" TIMESTAMP(3),
"name" TEXT NOT NULL,
"description" TEXT,
"price" INTEGER NOT NULL,
"currency" TEXT NOT NULL,
"workspaceId" TEXT NOT NULL,
"chatsLimit" INTEGER NOT NULL,
"storageLimit" INTEGER NOT NULL,
"seatsLimit" INTEGER NOT NULL,
CONSTRAINT "ClaimableCustomPlan_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "ClaimableCustomPlan_workspaceId_key" ON "ClaimableCustomPlan"("workspaceId");
-- AddForeignKey
ALTER TABLE "ClaimableCustomPlan" ADD CONSTRAINT "ClaimableCustomPlan_workspaceId_fkey" FOREIGN KEY ("workspaceId") REFERENCES "Workspace"("id") ON DELETE CASCADE ON UPDATE CASCADE;