44 lines
1.2 KiB
Plaintext
44 lines
1.2 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") //In the env file
|
||
|
}
|
||
|
|
||
|
model Blog {
|
||
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
||
|
slug String
|
||
|
title String
|
||
|
body String
|
||
|
categoryIDs String[]
|
||
|
tagIDs String[]
|
||
|
}
|
||
|
|
||
|
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("BlogCategories", fields: [blogIDs], references: [id])
|
||
|
}
|
||
|
|
||
|
model Tag {
|
||
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
||
|
name String
|
||
|
blogIDs String[] @db.ObjectId
|
||
|
blogs Blog[] @relation("BlogTags", fields: [blogIDs], references: [id])
|
||
|
}
|