CoastalCommitsPastes/client/prisma/schema.prisma

110 lines
2.8 KiB
Text

generator client {
provider = "prisma-client-js"
previewFeatures = ["fullTextSearch"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
relationMode = "prisma"
}
model SequelizeMeta {
name String @id
}
model File {
id String @id @default(cuid())
title String
content String
sha String
html String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
userId String
postId String
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
@@index([postId, userId, id])
@@map("files")
}
model Post {
id String @id @default(cuid())
title String
visibility String
password String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
expiresAt DateTime?
parentId String?
description String?
authorId String
files File[]
author User? @relation(fields: [authorId], references: [id])
@@index([authorId, id])
@@map("posts")
}
model Account {
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String?
access_token String?
expires_at Int?
token_type String?
scope String?
id_token String?
session_state String?
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @map("updated_at")
refresh_token_expires_in Int?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
@@index([userId, providerAccountId], map: "accounts_provider_account_id")
@@map("accounts")
}
model Session {
id String @id @default(cuid())
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@index([userId, expires], map: "sessions_user_id_expires")
@@map("sessions")
}
model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
role String? @default("user")
createdAt DateTime @default(now())
displayName String?
updatedAt DateTime @updatedAt
posts Post[]
accounts Account[]
sessions Session[]
@@map("users")
}
model VerificationToken {
identifier String
token String @unique
expires DateTime
@@unique([identifier, token])
@@map("verification_tokens")
}