add stripe (#121)
* add some stripe stuff * more stripe stuff * more stripe things * more stripr stuff * more stripe stuff * more stripe stuff * add more stuff * add more stripe stuff * more stuff * fix types
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[stripeCustomerId]` on the table `Team` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- CreateEnum
|
||||
CREATE TYPE "Plan" AS ENUM ('FREE', 'BASIC');
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Team" ADD COLUMN "plan" "Plan" NOT NULL DEFAULT 'FREE',
|
||||
ADD COLUMN "stripeCustomerId" TEXT;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Subscription" (
|
||||
"id" TEXT NOT NULL,
|
||||
"teamId" INTEGER NOT NULL,
|
||||
"status" TEXT NOT NULL,
|
||||
"priceId" TEXT NOT NULL,
|
||||
"currentPeriodEnd" TIMESTAMP(3),
|
||||
"currentPeriodStart" TIMESTAMP(3),
|
||||
"cancelAtPeriodEnd" TIMESTAMP(3),
|
||||
"paymentMethod" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "Subscription_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Team_stripeCustomerId_key" ON "Team"("stripeCustomerId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Subscription" ADD CONSTRAINT "Subscription_teamId_fkey" FOREIGN KEY ("teamId") REFERENCES "Team"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
@@ -0,0 +1,3 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Team" ADD COLUMN "billingEmail" TEXT,
|
||||
ADD COLUMN "isActive" BOOLEAN NOT NULL DEFAULT true;
|
@@ -90,11 +90,20 @@ model User {
|
||||
teamUsers TeamUser[]
|
||||
}
|
||||
|
||||
enum Plan {
|
||||
FREE
|
||||
BASIC
|
||||
}
|
||||
|
||||
model Team {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
plan Plan @default(FREE)
|
||||
stripeCustomerId String? @unique
|
||||
isActive Boolean @default(true)
|
||||
billingEmail String?
|
||||
teamUsers TeamUser[]
|
||||
domains Domain[]
|
||||
apiKeys ApiKey[]
|
||||
@@ -103,6 +112,22 @@ model Team {
|
||||
campaigns Campaign[]
|
||||
templates Template[]
|
||||
dailyEmailUsages DailyEmailUsage[]
|
||||
Subscription Subscription[]
|
||||
}
|
||||
|
||||
model Subscription {
|
||||
id String @id
|
||||
teamId Int
|
||||
status String
|
||||
priceId String
|
||||
currentPeriodEnd DateTime?
|
||||
currentPeriodStart DateTime?
|
||||
cancelAtPeriodEnd DateTime?
|
||||
paymentMethod String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
enum Role {
|
||||
|
Reference in New Issue
Block a user