CoastalCommitsPastes/client/prisma/schema.prisma

111 lines
2.8 KiB
Text
Raw Normal View History

2022-11-09 21:38:05 -05:00
generator client {
provider = "prisma-client-js"
previewFeatures = ["fullTextSearch"]
2022-11-09 21:38:05 -05:00
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
relationMode = "prisma"
2022-11-09 21:38:05 -05:00
}
model SequelizeMeta {
name String @id
}
model File {
id String @id @default(cuid())
title String
content String
sha String
2022-11-09 21:38:05 -05:00
html String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
userId String
postId String
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
2022-11-09 21:38:05 -05:00
@@index([postId, userId, id])
@@map("files")
2022-11-09 21:38:05 -05:00
}
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")
}
2022-11-09 21:38:05 -05:00
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")
2022-11-09 21:38:05 -05:00
}
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")
2022-11-09 21:38:05 -05:00
}