Skip to content

Commit 6291c45

Browse files
committed
some improvements
1 parent 4114236 commit 6291c45

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

.claude/rules/database-safety.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ paths:
55

66
# Database Migration Safety
77

8-
- `CREATE INDEX` must use `CONCURRENTLY` to avoid table locks in production.
9-
- `CONCURRENTLY` indexes **must be in their own separate migration file** - they cannot be combined with other schema changes (PostgreSQL requirement).
8+
- When adding indexes to **existing tables**, use `CREATE INDEX CONCURRENTLY IF NOT EXISTS` to avoid table locks. These must be in their own separate migration file (one index per file).
9+
- Indexes on **newly created tables** (same migration as `CREATE TABLE`) do not need CONCURRENTLY.
1010
- After generating a migration with Prisma, remove extraneous lines for: `_BackgroundWorkerToBackgroundWorkerFile`, `_BackgroundWorkerToTaskQueue`, `_TaskRunToTaskRunTag`, `_WaitpointRunConnections`, `_completedWaitpoints`, `SecretStore_key_idx`, and unrelated TaskRun indexes.
1111
- Never drop columns or tables without explicit approval.
1212
- New code should target `RunEngineVersion.V2` only.

.github/workflows/claude-md-audit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: 📝 CLAUDE.md Audit
22

33
on:
44
pull_request:
5-
types: [opened, ready_for_review]
5+
types: [opened, ready_for_review, synchronize]
66
paths-ignore:
77
- "docs/**"
88
- ".changeset/**"
@@ -27,7 +27,7 @@ jobs:
2727
- name: Checkout repository
2828
uses: actions/checkout@v4
2929
with:
30-
fetch-depth: 1
30+
fetch-depth: 0
3131

3232
- name: Run Claude Code
3333
id: claude

apps/webapp/CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Remix 2.1.0 app serving as the main API, dashboard, and orchestration engine. Us
66

77
- **Trigger API**: `app/routes/api.v1.tasks.$taskId.trigger.ts`
88
- **Batch trigger**: `app/routes/api.v1.tasks.batch.ts`
9-
- **OTEL endpoints**: `app/routes/otel.v1.logs.ts`, `otel.v1.traces.ts`
9+
- **OTEL endpoints**: `app/routes/otel.v1.logs.ts`, `app/routes/otel.v1.traces.ts`
1010
- **Prisma setup**: `app/db.server.ts`
1111
- **Run engine config**: `app/v3/runEngine.server.ts`
1212
- **Services**: `app/v3/services/**/*.server.ts`

internal-packages/database/CLAUDE.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,16 @@ New code should always target V2.
4040

4141
## Index Migration Rules
4242

43-
- Indexes **must use CONCURRENTLY** to avoid table locks
44-
- **CONCURRENTLY indexes must be in their own separate migration file** - they cannot be combined with other schema changes
43+
When adding indexes to **existing tables**:
44+
45+
- Use `CREATE INDEX CONCURRENTLY IF NOT EXISTS` to avoid table locks in production
46+
- CONCURRENTLY indexes **must be in their own separate migration file** - they cannot be combined with other schema changes (PostgreSQL requirement)
47+
- Only add one index per migration file
48+
- Pre-apply the index manually in production before deploying the migration (Prisma will skip creation if the index already exists)
49+
50+
Indexes on **newly created tables** (in the same migration as `CREATE TABLE`) do not need CONCURRENTLY and can be in the same migration file.
51+
52+
See `README.md` in this directory and `ai/references/migrations.md` for the full index workflow.
4553

4654
## Read Replicas
4755

0 commit comments

Comments
 (0)