v2 platform runtime (docs 22 Phase 2/4/7 + 17): Project/Environment + Config + Storage + Observability

- Project/Environment model with default environments (dev/staging/prod)
- Config Runtime: cascade resolution (platform→org→project→env), secrets via vault
- Storage Runtime: local provider, sha256 dedup, integrity check, file list/upload/delete
- Observability: execution query, per-action summary (success rate, avg, p95), health
- Realtime SSE: workspace event stream endpoint (GET /api/v1/v2/realtime/events)
- Phase 1 acceptance: core.health.check, core.user.create, core.user.list
- Actions: core.project.*, core.config.*, core.file.*, core.user.* (62 total)
This commit is contained in:
phptits
2026-09-11 21:11:07 +00:00
parent 72012a7da3
commit 851ccf1d7f
28 changed files with 87763 additions and 0 deletions
+70
View File
@@ -758,3 +758,73 @@ model ActionExecution {
@@index([actionId, createdAt])
@@index([status])
}
// ============ v2 P0/P1:Project / Environment / Config / Storage ============
/// # 数据库表 devos_projects:项目(组织内的工作与环境分组,docs 22 Phase 2)
model Project {
id String @id @default(uuid())
workspaceId String
name String
slug String
description String @default("")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
environments Environment[]
@@unique([workspaceId, slug])
@@index([workspaceId])
}
/// # 数据库表 devos_environments:项目环境(development/staging/production,docs 22 Phase 2)
model Environment {
id String @id @default(uuid())
projectId String
name String
/// # 数据库字段 环境级别:development / staging / production
level String @default("development")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
@@unique([projectId, name])
}
/// # 数据库表 devos_config_values:配置运行时(docs 22 Phase 4,级联解析)
model ConfigValue {
id String @id @default(uuid())
workspaceId String
/// # 数据库字段 作用域:platform / organization / project / environment
scope String
/// # 数据库字段 作用域对象 ID(platform 为空)
scopeId String?
key String
value String
/// # 数据库字段 是否敏感(读取时脱敏,存储用保险库加密)
isSecret Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([workspaceId, scope, scopeId, key])
@@index([workspaceId, key])
}
/// # 数据库表 devos_files:存储运行时文件记录(docs 15,File Resource)
model FileEntry {
id String @id @default(uuid())
workspaceId String
name String
originalName String
mimeType String
size Int
sha256 String
/// # 数据库字段 存储键(存储桶内路径,不含原始文件名)
storageKey String
/// # 数据库字段 存储提供者:local(后续 S3 兼容)
provider String @default("local")
createdAt DateTime @default(now())
@@index([workspaceId, createdAt])
}