Skip to content

Commit 71c7775

Browse files
authored
Merge pull request #3372 from AtCoder-NoviSteps/#3364
docs(rules): add rules and remove old plan and actions
2 parents 2b6e676 + 9680f90 commit 71c7775

4 files changed

Lines changed: 35 additions & 179 deletions

File tree

.claude/rules/github-actions.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
description: GitHub Actions workflow rules
3+
paths:
4+
- '.github/workflows/**'
5+
---
6+
7+
# GitHub Actions
8+
9+
## workflow_dispatch Requires the Default Branch
10+
11+
The GitHub Actions UI only shows `workflow_dispatch` workflows that exist on the **default branch** (staging in this repo). A workflow file that only exists on a feature branch cannot be triggered from the UI.
12+
13+
For one-time operational workflows (e.g. migration fixes): merge to staging first, then trigger the dispatch.

.claude/rules/prisma-db.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,28 @@ When the same constraint is enforced in both Zod (early validation) and SQL `CHE
119119
.refine(...)
120120
```
121121

122+
## @@map and Manual Migration SQL
123+
124+
When writing manual migration SQL for models that use `@@map`, always use the `@@map` value (the actual DB table name), not the Prisma model name. PostgreSQL treats quoted identifiers as case-sensitive, so `"VotedGradeCounter"` and `"votedgradecounter"` refer to different tables.
125+
126+
```sql
127+
-- Bad: Prisma model name does not exist as a table
128+
ALTER TABLE "VotedGradeCounter" ADD CONSTRAINT ...
129+
130+
-- Good: use the @@map value
131+
ALTER TABLE "votedgradecounter" ADD CONSTRAINT ...
132+
```
133+
134+
## P3009: Recovering from a Failed Migration
135+
136+
When a migration leaves `finished_at = NULL` in `_prisma_migrations`:
137+
138+
1. **Delete the broken migration file** from git (`git rm -r prisma/migrations/<name>/`) — leaving it causes `migrate dev` to fail on other machines.
139+
2. Mark it as rolled back: `pnpm exec prisma migrate resolve --rolled-back <name>`
140+
3. Create a **new migration with a new timestamp** containing the corrected SQL and deploy it.
141+
142+
A `--rolled-back` migration is permanently skipped by `migrate deploy`; fixing the original file has no effect.
143+
122144
## Validate Constraints
123145

124146
Prisma does not support `@@check`. To add one:

.github/workflows/resolve-migration.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/dev-notes/2026-04-09/fix-vote-grade-check-constraints/plan.md

Lines changed: 0 additions & 153 deletions
This file was deleted.

0 commit comments

Comments
 (0)