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.
git clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collectionWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/database-migrations)<a href="https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/database-migrations"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/database-migrations/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/database-migrations"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/database-migrations.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What 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.1 | $0.00477 | $0.00477 |
| Opus 5.5 | $0.00191 | $0.00191 |
| Sonnet 5.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 1mo 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.
- 1mo 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 (38 stars, last pushed 7mo ago), licensed MIT. It adds 477 tokens to every session, about $0.0019 per session on Opus 5.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.
Other cursor rules, from other repositories
30-database-postgres
PostgreSQL and persistence rules.
mysql-auto
This rule enforces MySQL-specific best practices to enhance readability, performance, security, and maintainability. It targets MySQL features (e.g., storage engines, character sets) and common pitfalls, and adds concrete guidance for schema design and creation.
40-cache-redis
Redis caching and queue rules.
auto-update-llms-robots-txt
Auto-update llms.txt and robots.txt when pages are created or edited.
10-feature-development
Feature implementation workflow and engineering mindset.
11-template-conventions
Reusable building blocks shipped with this template - use them instead of writing new ones.