26 lines
957 B
Markdown
26 lines
957 B
Markdown
|
|
# Task ID: 119
|
||
|
|
|
||
|
|
**Title:** Add CodeRepo Prisma model
|
||
|
|
|
||
|
|
**Status:** pending
|
||
|
|
|
||
|
|
**Dependencies:** None
|
||
|
|
|
||
|
|
**Priority:** high
|
||
|
|
|
||
|
|
**Description:** Add CodeRepo model to schema.prisma for git repository management within projects
|
||
|
|
|
||
|
|
**Details:**
|
||
|
|
|
||
|
|
In src/db/prisma/schema.prisma add:
|
||
|
|
1. model CodeRepo with: id, name, projectId, url, defaultBranch (@default("main")), path (@default("")), provider (@default("gitea")), credSecretId?, credSecretKey?, ownerId, version, createdAt, updatedAt
|
||
|
|
2. Relations: project (Project), cred (Secret?), owner (User), tasks (Task[])
|
||
|
|
3. @@unique([name, projectId]), @@index([projectId])
|
||
|
|
4. Add repos CodeRepo[] relation to Project model
|
||
|
|
5. Add codeRepos CodeRepo[] relation to Secret model
|
||
|
|
6. Add ownedRepos CodeRepo[] relation to User model
|
||
|
|
|
||
|
|
**Test Strategy:**
|
||
|
|
|
||
|
|
Schema tests: create CodeRepo linked to Project, verify unique constraint on (name, projectId), test cascade delete from Project, test SetNull behavior when Secret is deleted.
|