mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-21 12:56:21 +02:00
💳 Support payments with Stripe (#822)
This commit is contained in:
parent
969ae35971
commit
6f425edeaa
20 changed files with 712 additions and 229 deletions
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[subscription_id]` on the table `users` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "users" ADD COLUMN "customer_id" TEXT,
|
||||
ADD COLUMN "subscription_id" TEXT;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "subscriptions" (
|
||||
"id" TEXT NOT NULL,
|
||||
"price_id" TEXT NOT NULL,
|
||||
"active" BOOLEAN NOT NULL,
|
||||
"currency" TEXT,
|
||||
"interval" TEXT,
|
||||
"interval_count" INTEGER,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"period_start" TIMESTAMP(3) NOT NULL,
|
||||
"period_end" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "subscriptions_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "users_subscription_id_key" ON "users"("subscription_id");
|
|
@ -17,15 +17,18 @@ enum TimeFormat {
|
|||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
email String @unique() @db.Citext
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt @map("updated_at")
|
||||
comments Comment[]
|
||||
polls Poll[]
|
||||
watcher Watcher[]
|
||||
events Event[]
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
email String @unique() @db.Citext
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt @map("updated_at")
|
||||
comments Comment[]
|
||||
polls Poll[]
|
||||
watcher Watcher[]
|
||||
events Event[]
|
||||
customerId String? @map("customer_id")
|
||||
subscription Subscription? @relation(fields: [subscriptionId], references: [id])
|
||||
subscriptionId String? @unique @map("subscription_id")
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
|
@ -52,6 +55,21 @@ model UserPaymentData {
|
|||
@@map("user_payment_data")
|
||||
}
|
||||
|
||||
model Subscription {
|
||||
id String @id
|
||||
priceId String @map("price_id")
|
||||
active Boolean
|
||||
currency String?
|
||||
interval String?
|
||||
intervalCount Int? @map("interval_count")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
periodStart DateTime @map("period_start")
|
||||
periodEnd DateTime @map("period_end")
|
||||
user User?
|
||||
|
||||
@@map("subscriptions")
|
||||
}
|
||||
|
||||
model UserPreferences {
|
||||
userId String @id @map("user_id")
|
||||
timeZone String? @map("time_zone")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue