123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- generator client {
- provider = "prisma-client-js"
- }
- datasource db {
- provider = "postgresql"
- url = env("POSTGRES_PRISMA_URL")
- directUrl = env("POSTGRES_URL_NON_POOLING")
- }
- model Account {
- id String @id @default(cuid())
- userId String @map("user_id")
- type String
- provider String
- providerAccountId String @map("provider_account_id")
- refresh_token String?
- access_token String?
- expires_at Int?
- token_type String?
- scope String?
- id_token String?
- session_state String?
- refresh_token_expires_in Int?
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
- @@unique([provider, providerAccountId])
- @@map("accounts")
- }
- model Session {
- id String @id @default(cuid())
- sessionToken String @unique @map("session_token")
- userId String @map("user_id")
- expires DateTime
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
- @@map("sessions")
- }
- model User {
- id String @id @default(cuid())
- name String?
- email String? @unique
- emailVerified DateTime? @map("email_verified")
- image String?
- accounts Account[]
- sessions Session[]
- subscription Subscription[]
- @@map("users")
- }
- model VerificationToken {
- identifier String
- token String @unique
- expires DateTime
- @@unique([identifier, token])
- @@map("verificationtokens")
- }
- model Subscription {
- id Int @id @default(autoincrement())
- lemonSqueezyId Int @unique @map("lemon_squeezy_id")
- orderId Int @unique @map("order_id")
- name String
- email String
- status String
- renewsAt DateTime? @map("renews_at")
- endsAt DateTime? @map("ends_at")
- trialEndsAt DateTime? @map("trial_ends_at")
- resumesAt DateTime? @map("resumes_at")
- price Int
- plan Plan @relation(fields: [planId], references: [id])
- planId Int @map("plan_id")
- user User @relation(fields: [userId], references: [id])
- userId String @map("user_id")
- isUsageBased Boolean @default(false) @map("is_usage_based")
- subscriptionItemId Int? @unique @map("subscription_item_id")
- @@index([planId, lemonSqueezyId])
- }
- model Plan {
- id Int @id @default(autoincrement())
- productId Int @map("product_id")
- variantId Int @unique @map("variant_id")
- name String? // Need to get from Product
- description String?
- variantName String @map("variant_name")
- sort Int
- status String
- price Int
- interval String
- intervalCount Int @default(1) @map("interval_count")
- subscriptions Subscription[]
- }
- model WebhookEvent {
- id Int @id @default(autoincrement())
- createdAt DateTime @default(now()) @map("created_at")
- eventName String @map("event_name")
- processed Boolean @default(false)
- body Json
- processingError String? @map("processing_error")
- }
|