63 lines
1.3 KiB
Plaintext
63 lines
1.3 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
|
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
generator typegraphql {
|
|
provider = "typegraphql-prisma"
|
|
output = "generated/type-graphql"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Post {
|
|
id String @id @default(uuid())
|
|
createdAt DateTime @unique @default(now())
|
|
updatedAt DateTime @unique @updatedAt
|
|
title String? // ? means that title is nullable
|
|
content String
|
|
authorID String
|
|
author User @relation(fields: [authorID], references: [id])
|
|
points Int @default(0)
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
username String @unique
|
|
password String
|
|
email String? @unique
|
|
Posts Post[]
|
|
}
|
|
|
|
model Upvote {
|
|
userID String
|
|
postID String
|
|
|
|
@@unique([userID, postID])
|
|
}
|
|
|
|
model Downvote {
|
|
userID String
|
|
postID String
|
|
|
|
@@unique([userID, postID])
|
|
}
|
|
|
|
model ResetPasswordToken {
|
|
id String @id @default(cuid())
|
|
userID String
|
|
value String @unique
|
|
|
|
@@unique([userID, value])
|
|
}
|