Skip to content

Instantly share code, notes, and snippets.

@dipeshhkc
Created January 13, 2023 04:41
Show Gist options
  • Save dipeshhkc/41848a6d1e424b9edbd467e265ab52fe to your computer and use it in GitHub Desktop.
Save dipeshhkc/41848a6d1e424b9edbd467e265ab52fe to your computer and use it in GitHub Desktop.
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
email String @unique
subscription_id Int?
trial_ends_at DateTime?
created_at DateTime @default(now())
updated_at DateTime @default(now()) @updatedAt
subscription Subscription? @relation(fields: [subscription_id], references: [id])
@@map("users")
}
model Subscription {
id Int @id @default(autoincrement())
stripe_subscription_id String
stripe_customer_id String
stripe_plan_id String
stripe_plan_name String?
stripe_status String?
ends_at DateTime?
userId Int
created_at DateTime @default(now())
updated_at DateTime @default(now()) @updatedAt
User User[]
@@map("subscriptions")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment