Capital/content/schema.prisma

156 lines
5.2 KiB
Plaintext
Raw Normal View History

2024-01-21 16:28:49 +00:00
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.
datasource postgresql {
url = env("DATABASE_URL")
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
provider = "postgresql"
}
generator client {
provider = "prisma-client-js"
}
model User {
id String @id @default(cuid())
name String @default("")
email String @unique @default("")
password String
posts Post[] @relation("Post_author")
moments Moment[] @relation("Moment_author")
events Event[] @relation("Event_author")
isAdmin Boolean @default(false)
isEditor Boolean @default(false)
createdAt DateTime? @default(now())
}
model Image {
id String @id @default(cuid())
caption String @default("")
image_filesize Int?
image_extension String?
image_width Int?
image_height Int?
image_id String?
createdAt DateTime? @default(now())
from_Post_cover Post[] @relation("Post_cover")
from_Post_images Post[] @relation("Post_images")
from_Moment_images Moment[] @relation("Moment_images")
from_Project_icon Project[] @relation("Project_icon")
}
model Asset {
id String @id @default(cuid())
caption String @default("")
url String @default("")
type AssetTypeType @default(video) @map("media_type")
createdAt DateTime? @default(now())
from_Post_assets Post[] @relation("Post_assets")
}
model Post {
id String @id @default(cuid())
slug String @unique @default("")
title String @default("")
cover Image? @relation("Post_cover", fields: [coverId], references: [id])
coverId String? @map("cover")
description String @default("")
assets Asset[] @relation("Post_assets")
images Image[] @relation("Post_images")
content Json @default("[{\"type\":\"paragraph\",\"children\":[{\"text\":\"\"}]}]")
type PostTypeType @default(article) @map("post_type")
isPublished Boolean @default(false)
author User? @relation("Post_author", fields: [authorId], references: [id])
authorId String? @map("author")
categories Category[] @relation("Category_posts")
tags Tag[] @relation("Post_tags")
createdAt DateTime? @default(now())
from_Project_post Project[] @relation("Project_post")
@@index([coverId])
@@index([authorId])
}
model Moment {
id String @id @default(cuid())
title String @default("")
images Image[] @relation("Moment_images")
content Json @default("[{\"type\":\"paragraph\",\"children\":[{\"text\":\"\"}]}]")
author User? @relation("Moment_author", fields: [authorId], references: [id])
authorId String? @map("author")
categories Category[] @relation("Category_moments")
tags Tag[] @relation("Moment_tags")
createdAt DateTime? @default(now())
@@index([authorId])
}
model Project {
id String @id @default(cuid())
icon Image? @relation("Project_icon", fields: [iconId], references: [id])
iconId String? @map("icon")
name String @default("")
description String @default("")
link String @default("")
isPublished Boolean @default(false)
status ProjectStatusType @default(pending) @map("project_status")
post Post? @relation("Project_post", fields: [postId], references: [id])
postId String? @map("post")
createdAt DateTime? @default(now())
@@index([iconId])
@@index([postId])
}
model Event {
id String @id @default(cuid())
slug String @unique @default("")
title String @default("")
description String @default("")
content Json @default("[{\"type\":\"paragraph\",\"children\":[{\"text\":\"\"}]}]")
isPublished Boolean @default(false)
isHistory Boolean @default(false)
author User? @relation("Event_author", fields: [authorId], references: [id])
authorId String? @map("author")
categories Category[] @relation("Category_events")
tags Tag[] @relation("Event_tags")
createdAt DateTime? @default(now())
@@index([authorId])
}
model Category {
id String @id @default(cuid())
slug String @unique @default("")
name String @default("")
posts Post[] @relation("Category_posts")
moments Moment[] @relation("Category_moments")
events Event[] @relation("Category_events")
}
model Tag {
id String @id @default(cuid())
slug String @unique @default("")
name String @default("")
posts Post[] @relation("Post_tags")
moments Moment[] @relation("Moment_tags")
events Event[] @relation("Event_tags")
}
enum AssetTypeType {
video
audio
}
enum PostTypeType {
article
podcast
}
enum ProjectStatusType {
pending
constructing
published
abandoned
}