You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Fix prisma-db.md: clarify schema.prisma as source of truth for CHECK constraints
- Fix spelling: "Parametrized" → "Parameterized" in testing-e2e.md and testing.md
- Update median.ts to use MIN_VOTES_FOR_STATISTICS constant instead of hardcoded 3
- Fix globalThis.location state leak in vote_grade.test.ts by saving/restoring
- Simplify getBaseUrl() by removing unreachable 'http://localhost' fallback
- Move task_grade.test.ts from src/test/utils/ to src/lib/utils/ (adjacent pattern)
- Add src/lib/**/*.test.ts to vite.config.ts test.include
- Add 3 new testing patterns to rules/testing.md (multi-location tests, globalThis mocking, guard clause reachability)
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .claude/rules/prisma-db.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,7 @@ user User @relation(fields: [userId], references: [id])
98
98
99
99
## DB-Level Value Constraints
100
100
101
-
Add `CHECK` constraints (via manual migration SQL) for count and invalid enum values. Document with inline `schema.prisma` comments (e.g., `/// CHECK: count >= 0`) —`prisma-erd-generator`overwrites `ERD.md` on each migration.
101
+
Add `CHECK` constraints via manual migration SQL. Document with inline `schema.prisma` comments (e.g., `/// CHECK: count >= 0`). Note:`prisma-erd-generator`may overwrite `ERD.md` on each migration—always keep the constraint definition in `schema.prisma` as the source of truth.
102
102
103
103
## Service Layer Error Handling
104
104
@@ -125,9 +125,10 @@ Prisma does not support `@@check`. To add one:
125
125
126
126
1.`pnpm exec prisma migrate dev --create-only --name <description>` — generate migration without applying
127
127
2. Edit the generated `migration.sql` to add the CHECK constraint manually
128
-
3.`pnpm exec prisma migrate dev` — apply
128
+
3. Add an inline comment in `schema.prisma` (e.g., `/// CHECK: constraint description`)
129
+
4.`pnpm exec prisma migrate dev` — apply
129
130
130
-
Document the constraint in `prisma/ERD.md` (the only place it's visible):
131
+
For visibility, also document complex constraints in `prisma/ERD.md`:
131
132
132
133
```mermaid
133
134
%% XOR constraint: workbookplacement_xor_grade_category — exactly one of taskGrade or solutionCategory must be non-null
0 commit comments