Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .claude/rules/github-actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
description: GitHub Actions workflow rules
paths:
- '.github/workflows/**'
---

# GitHub Actions

## workflow_dispatch Requires the Default Branch

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.

For one-time operational workflows (e.g. migration fixes): merge to staging first, then trigger the dispatch.
22 changes: 22 additions & 0 deletions .claude/rules/prisma-db.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,28 @@ When the same constraint is enforced in both Zod (early validation) and SQL `CHE
.refine(...)
```

## @@map and Manual Migration SQL

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.

```sql
-- Bad: Prisma model name does not exist as a table
ALTER TABLE "VotedGradeCounter" ADD CONSTRAINT ...

-- Good: use the @@map value
ALTER TABLE "votedgradecounter" ADD CONSTRAINT ...
```

## P3009: Recovering from a Failed Migration

When a migration leaves `finished_at = NULL` in `_prisma_migrations`:

1. **Delete the broken migration file** from git (`git rm -r prisma/migrations/<name>/`) — leaving it causes `migrate dev` to fail on other machines.
2. Mark it as rolled back: `pnpm exec prisma migrate resolve --rolled-back <name>`
3. Create a **new migration with a new timestamp** containing the corrected SQL and deploy it.

A `--rolled-back` migration is permanently skipped by `migrate deploy`; fixing the original file has no effect.

## Validate Constraints

Prisma does not support `@@check`. To add one:
Expand Down
26 changes: 0 additions & 26 deletions .github/workflows/resolve-migration.yml

This file was deleted.

153 changes: 0 additions & 153 deletions docs/dev-notes/2026-04-09/fix-vote-grade-check-constraints/plan.md

This file was deleted.

Loading