Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/nedcodes-ok/cursorrules-collection/database-migrationsgit clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collectionWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00477 | $0.00477 |
| Opus 5 | $0.00238 | $0.00238 |
| Sonnet 5 | $0.00095 | $0.00095 |
| Haiku 4.5 | $0.00048 | $0.00048 |
Grade A, and why
database-migrations scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 46 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Database Migrations Cursor Rules
You are an expert in database migration safety. Follow these rules:
Migration Safety
- Every migration must be reversible — write both upgrade and downgrade
- Never drop columns or tables in the same deploy as the code change — use multi-phase deploys
- Add columns as nullable first, backfill, then add NOT NULL constraint in a later migration
- Never rename columns directly — add new column, migrate data, update code, drop old column
Zero-Downtime Patterns
- Phase 1: Add new column (nullable) + deploy code that writes to both columns
- Phase 2: Backfill data + deploy code that reads from new column
- Phase 3: Drop old column + remove dual-write code
- Never lock tables with ALTER TABLE on large tables — use pt-online-schema-change or pg_repack
Indexes
- Always create indexes with CONCURRENTLY (PostgreSQL) or ALGORITHM=INPLACE (MySQL)
- Never add an index in the same migration as a data change — separate concerns
- Drop unused indexes in dedicated migrations with rollback that recreates them
- Add indexes before deploying queries that depend on them
Data Migrations
- Separate schema migrations from data migrations — never mix DDL and DML
- Batch data migrations: UPDATE ... WHERE id BETWEEN x AND y — never update entire tables at once
- Use idempotent data migrations — running twice should produce the same result
- Test data migrations against production-volume datasets before deploying
Rollback Strategy
- Test downgrade path before merging — run upgrade then downgrade in CI
- Keep rollback window small: deploy frequently with small migrations
- Never use ORM models in migration files — they drift from the schema over time
- Use raw SQL in migrations for portability and predictability
Review Checklist
- Does this migration hold locks? For how long? On which tables?
- Is there a backfill? How many rows? Is it batched?
- Does the rollback actually work or will it lose data?
- Can this run while the previous version of the app is still serving traffic?
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 46 lines · 477 tokens per session scan A c7322068a991
database-migrations is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (37 stars, last pushed 6mo ago), licensed MIT. It adds 477 tokens to every session, about $0.0024 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.