Files
hlae-site/backend/prisma/schema.prisma
purp1e 35d835f68c chore: 统一代码格式并配置开发工具
- 添加 ESLint 和 Prettier 配置以统一代码风格
- 配置项目级 TypeScript 设置
- 更新前后端依赖版本
- 修复代码格式问题(引号、分号、尾随逗号等)
- 优化文件结构和导入路径
2026-03-10 18:24:19 +08:00

108 lines
2.7 KiB
Plaintext

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
engineType = "client"
runtime = "bun"
}
datasource db {
provider = "sqlite"
}
model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
phone String? @unique
phoneVerified DateTime?
image String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
accounts Account[]
sessions Session[]
posts Post[]
comments Comment[]
}
model Account {
id String @id @default(cuid())
userId String @map("user_id")
type String
provider String
providerAccountId String @map("provider_account_id")
refresh_token String?
access_token String?
expires_at Int?
token_type String?
scope String?
id_token String?
session_state String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
@@map("accounts")
}
model Session {
id String @id @default(cuid())
sessionToken String @unique @map("session_token")
userId String @map("user_id")
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@map("sessions")
}
model Post {
id String @id @default(cuid())
title String
content String
userId String @map("user_id")
published Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
comments Comment[]
@@map("posts")
}
model Resource {
id String @id @default(cuid())
title String
description String?
url String
icon String?
category String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("resources")
}
model Comment {
id String @id @default(cuid())
content String
userId String @map("user_id")
postId String @map("post_id")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
@@map("comments")
}
model VerificationToken {
identifier String
token String @unique
expires DateTime
@@unique([identifier, token])
@@map("verification_tokens")
}