105 lines
3 KiB
Text
105 lines
3 KiB
Text
// 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"
|
|
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
// NOTE: When using postgresql, mysql or sqlserver, uncomment the @db.Text annotations in model Account below
|
|
// Further reading:
|
|
// https://next-auth.js.org/adapters/prisma#create-the-prisma-schema
|
|
// https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#string
|
|
url = env("DATABASE_URL")
|
|
relationMode = "prisma"
|
|
}
|
|
|
|
model Video {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
title String
|
|
userId String
|
|
sharing Boolean @default(false)
|
|
delete_after_link_expires Boolean @default(false)
|
|
shareLinkExpiresAt DateTime?
|
|
linkShareSeo Boolean @default(false)
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([userId])
|
|
}
|
|
|
|
// Necessary for Next auth
|
|
model Account {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
type String
|
|
provider String
|
|
providerAccountId String
|
|
refresh_token String? @db.Text
|
|
access_token String? @db.Text
|
|
expires_at Int?
|
|
token_type String?
|
|
scope String?
|
|
id_token String? @db.Text
|
|
session_state String?
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([provider, providerAccountId])
|
|
}
|
|
|
|
model Session {
|
|
id String @id @default(cuid())
|
|
sessionToken String @unique
|
|
userId String
|
|
expires DateTime
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
name String?
|
|
email String? @unique
|
|
emailVerified DateTime?
|
|
image String?
|
|
accounts Account[]
|
|
sessions Session[]
|
|
videos Video[]
|
|
stripeCustomerId String?
|
|
stripeSubscriptionId String?
|
|
stripeSubscriptionStatus StripeSubscriptionStatus?
|
|
}
|
|
|
|
enum StripeSubscriptionStatus {
|
|
incomplete
|
|
incomplete_expired
|
|
trialing
|
|
active
|
|
past_due
|
|
canceled
|
|
unpaid
|
|
paused
|
|
}
|
|
|
|
model StripeEvent {
|
|
id String @id @unique
|
|
api_version String?
|
|
data Json
|
|
request Json?
|
|
type String
|
|
object String
|
|
account String?
|
|
created DateTime
|
|
livemode Boolean
|
|
pending_webhooks Int
|
|
}
|
|
|
|
model VerificationToken {
|
|
identifier String
|
|
token String @unique
|
|
expires DateTime
|
|
|
|
@@unique([identifier, token])
|
|
}
|