49 lines
1.4 KiB
Plaintext
49 lines
1.4 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"
|
||
|
}
|
||
|
|
||
|
datasource db {
|
||
|
provider = "mongodb"
|
||
|
url = env("DATABASE_URL")
|
||
|
}
|
||
|
|
||
|
model Blog {
|
||
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
||
|
slug String @unique
|
||
|
title String
|
||
|
body String
|
||
|
comments Comment[]
|
||
|
coverImage String?
|
||
|
categoryIDs String[] @db.ObjectId
|
||
|
categories Category[] @relation(fields: [categoryIDs], references: [id])
|
||
|
tagIDs String[] @db.ObjectId
|
||
|
tags Tag[] @relation(fields: [tagIDs], references: [id])
|
||
|
}
|
||
|
|
||
|
model Comment {
|
||
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
||
|
comment String
|
||
|
blog Blog @relation(fields: [blogId], references: [id])
|
||
|
blogId String @db.ObjectId
|
||
|
}
|
||
|
|
||
|
model Category {
|
||
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
||
|
name String
|
||
|
blogIDs String[] @db.ObjectId
|
||
|
blogs Blog[] @relation(fields: [blogIDs], references: [id])
|
||
|
}
|
||
|
|
||
|
model Tag {
|
||
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
||
|
name String
|
||
|
blogIDs String[] @db.ObjectId
|
||
|
blogs Blog[] @relation(fields: [blogIDs], references: [id])
|
||
|
}
|