1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-31 06:18:07 +00:00
_/nexus-with-prisma/prisma/schema.prisma

46 lines
1 KiB
Text
Raw Normal View History

2020-10-08 15:36:55 +09:00
datasource db {
provider = "sqlite"
url = "file:db.sqlite"
}
generator prisma_client_js {
provider = "prisma-client-js"
}
model Blog {
id Int @default(autoincrement()) @id
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String
viewCount Int @default(0)
posts Post[]
authors User[]
}
model User {
id Int @default(autoincrement()) @id
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String?
posts Post[]
blogId Int?
blog Blog? @relation(fields: [blogId], references: [id])
rating Float
}
model Post {
id Int @default(autoincrement()) @id
title String
tags Tag[] @relation(references: [id])
blogId Int?
blog Blog? @relation(fields: [blogId], references: [id])
User User? @relation(fields: [userId], references: [id])
userId Int?
}
model Tag {
id Int @default(autoincrement()) @id
label String
posts Post[] @relation(references: [id])
}