118 lines
3.2 KiB
Plaintext
118 lines
3.2 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-js"
|
|
output = "./generated/client"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
/// 网盘类型枚举
|
|
enum DriveType {
|
|
/// 百度网盘
|
|
BAIDU
|
|
/// 阿里云盘
|
|
ALIYUN
|
|
/// 其他网盘类型可以在这里添加
|
|
}
|
|
|
|
/// 网盘账号信息表
|
|
model Account {
|
|
/// 账号ID
|
|
id Int @id @default(autoincrement())
|
|
/// 网盘类型
|
|
driveType DriveType
|
|
/// 账号标识符(如:用户名、邮箱等)
|
|
accountIdentifier String
|
|
/// 账号凭证(密码)
|
|
credentials String @db.Text
|
|
/// 账号状态(active: 活跃, inactive: 未激活, blocked: 被封禁)
|
|
status String @default("active")
|
|
/// 最后检查时间
|
|
lastChecked DateTime?
|
|
/// 创建时间
|
|
createdAt DateTime @default(now())
|
|
/// 更新时间
|
|
updatedAt DateTime @updatedAt
|
|
/// 转码记录关联
|
|
transcodeRecords TranscodeRecord[]
|
|
/// 活动日志关联
|
|
activityLogs ActivityLog[]
|
|
}
|
|
|
|
/// 转码记录表
|
|
model TranscodeRecord {
|
|
/// 记录ID
|
|
id Int @id @default(autoincrement())
|
|
/// 项目ID
|
|
itemId String
|
|
/// 源文件链接
|
|
sourceLink String @db.Text
|
|
/// 网盘类型
|
|
driveType DriveType
|
|
/// 管理的账号ID
|
|
managedAccountId Int
|
|
/// 转码状态(pending: 等待中, processing: 处理中, completed: 完成, failed: 失败)
|
|
status String @default("pending")
|
|
/// 临时分享链接
|
|
tempLink String? @db.Text
|
|
/// 转存后的文件ID
|
|
transferredFileId String?
|
|
/// 转存开始时间
|
|
transferStartTime DateTime @default(now())
|
|
/// 转存结束时间
|
|
transferEndTime DateTime?
|
|
/// 错误代码
|
|
errorCode String?
|
|
/// 错误信息
|
|
errorMessage String? @db.Text
|
|
/// 清理状态(pending: 待清理, completed: 已清理, failed: 清理失败)
|
|
cleanupStatus String @default("pending")
|
|
/// 创建时间
|
|
createdAt DateTime @default(now())
|
|
/// 更新时间
|
|
updatedAt DateTime @updatedAt
|
|
/// 关联的账号
|
|
account Account @relation(fields: [managedAccountId], references: [id])
|
|
|
|
@@index([itemId])
|
|
@@index([cleanupStatus])
|
|
}
|
|
|
|
/// 活动日志表
|
|
model ActivityLog {
|
|
/// 日志ID
|
|
id BigInt @id @default(autoincrement())
|
|
/// 时间戳
|
|
timestamp DateTime @default(now())
|
|
/// 操作类型
|
|
operationType String
|
|
/// 客户端IP
|
|
clientIp String?
|
|
/// 关键词
|
|
keyword String?
|
|
/// 项目ID
|
|
itemId String?
|
|
/// 网盘类型
|
|
driveType DriveType?
|
|
/// 管理的账号ID
|
|
managedAccountId Int?
|
|
/// 生成的链接
|
|
generatedLink String? @db.Text
|
|
/// 错误代码
|
|
errorCode String?
|
|
/// 错误信息
|
|
errorMessage String? @db.Text
|
|
/// 操作持续时间(毫秒)
|
|
durationMs Int?
|
|
/// 详细信息
|
|
details String? @db.Text
|
|
/// 关联的账号
|
|
account Account? @relation(fields: [managedAccountId], references: [id])
|
|
|
|
@@index([itemId])
|
|
} |