- Add projectDir field to Project model for workspace directory management - Implement workspace directory creation, validation and Git initialization - Add workspace status query endpoint with directory info and Git status - Create GitManager for Git repository operations (clone, branch, commit info) - Add PathValidator for secure path validation and traversal attack prevention - Implement execution queue with concurrency control for build tasks - Refactor project list UI to remove edit/delete actions from cards - Add project settings tab in detail page with edit/delete functionality - Add icons to all tabs (History, Code, Settings) - Implement time formatting with dayjs in YYYY-MM-DD HH:mm:ss format - Display all timestamps using browser's local timezone - Update PipelineRunner to use workspace directory for command execution - Add workspace status card showing directory path, size, Git info - Enhance CreateProjectModal with repository URL validation
96 lines
2.4 KiB
Plaintext
96 lines
2.4 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 = "../generated"
|
||
}
|
||
|
||
datasource db {
|
||
provider = "sqlite"
|
||
}
|
||
|
||
model Project {
|
||
id Int @id @default(autoincrement())
|
||
name String
|
||
description String?
|
||
repository String
|
||
projectDir String @unique // 项目工作目录路径(必填)
|
||
// Relations
|
||
deployments Deployment[]
|
||
pipelines Pipeline[]
|
||
|
||
valid Int @default(1)
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
createdBy String
|
||
updatedBy String
|
||
}
|
||
|
||
model User {
|
||
id Int @id @default(autoincrement())
|
||
username String
|
||
login String
|
||
email String
|
||
avatar_url String?
|
||
active Boolean @default(true)
|
||
valid Int @default(1)
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
createdBy String @default("system")
|
||
updatedBy String @default("system")
|
||
}
|
||
|
||
model Pipeline {
|
||
id Int @id @default(autoincrement())
|
||
name String
|
||
description String?
|
||
valid Int @default(1)
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
createdBy String
|
||
updatedBy String
|
||
|
||
// Relations
|
||
projectId Int?
|
||
Project Project? @relation(fields: [projectId], references: [id])
|
||
steps Step[]
|
||
}
|
||
|
||
model Step {
|
||
id Int @id @default(autoincrement())
|
||
name String
|
||
order Int
|
||
script String // 执行的脚本命令
|
||
valid Int @default(1)
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
createdBy String
|
||
updatedBy String
|
||
|
||
pipelineId Int
|
||
pipeline Pipeline @relation(fields: [pipelineId], references: [id])
|
||
}
|
||
|
||
model Deployment {
|
||
id Int @id @default(autoincrement())
|
||
branch String
|
||
env String?
|
||
status String // pending, running, success, failed, cancelled
|
||
commitHash String?
|
||
commitMessage String?
|
||
buildLog String?
|
||
sparseCheckoutPaths String? // 稀疏检出路径,用于monorepo项目
|
||
startedAt DateTime @default(now())
|
||
finishedAt DateTime?
|
||
valid Int @default(1)
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
createdBy String
|
||
updatedBy String
|
||
|
||
projectId Int
|
||
Project Project? @relation(fields: [projectId], references: [id])
|
||
pipelineId Int
|
||
}
|