database-migration-snapshots

database-migration-snapshots is a cursor rule for Cursor from paperclipai/paperclip. It costs 0 tokens per session (607 once invoked), scanned A, original, MIT.

A database-change rule for Drizzle, a tool that generates database migrations from schema changes. It limits stored schema snapshots while preserving the SQL migration history and migration journal.

In plain words
What is it for?
Use it when generating, merging, rebasing, renumbering, or reviewing database migrations and their snapshot files.
Why use it?
It prevents old snapshot files from accumulating or being mistaken for backups, while keeping the executable history needed to update databases.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it when generating, merging, rebasing, renumbering, or reviewing database migrations and their snapshot files.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/paperclipai/paperclip/database-migration-snapshots
About the project

Paperclip is a Node.js server and React application for coordinating AI agents as a business team, with goals, organizational roles, budgets, governance, and work tracking in one interface. It is used by people managing multiple agents or autonomous agent organizations across tools such as OpenClaw, Claude Code, Codex, and Cursor. The catalogue includes skills, agents, an MCP add-on, and an instruction for working with Paperclip.

paperclipai/paperclip · 102,719 stars · on GitHub · paperclip.ing

Install

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.

Clone the repo
git clone --depth 1 https://github.com/paperclipai/paperclip

Made for: Cursor.

Wrote 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.

agentmods badge for database-migration-snapshots

README.md
[![agentmods](https://agentmods.dev/badge/rules/paperclipai/paperclip/database-migration-snapshots/github.svg)](https://agentmods.dev/rules/paperclipai/paperclip/database-migration-snapshots)
Your own site
<a href="https://agentmods.dev/rules/paperclipai/paperclip/database-migration-snapshots"><img src="https://agentmods.dev/badge/rules/paperclipai/paperclip/database-migration-snapshots/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.

agentmods 80×15 button for database-migration-snapshots

Your own site · 80×15
<a href="https://agentmods.dev/rules/paperclipai/paperclip/database-migration-snapshots"><img src="https://agentmods.dev/badge/rules/paperclipai/paperclip/database-migration-snapshots.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 607 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00607
Opus 5.5 $0.00000 $0.00243
Sonnet 5.5 $0.00000 $0.00121
Haiku 4.5 $0.00000 $0.00061

Measured 2d ago against content hash 6198e92a559b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

database-migration-snapshots 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.

rules/database-migration-snapshots.mdc · 60 lines

How it starts

The opening of the file, as written. The whole thing — 60 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Database migration snapshots

Scope and purpose

This rule applies to database schema changes, migration files, and migration generation configuration. Drizzle snapshots under packages/db/src/migrations/meta/ describe schema state for future generation. They are not database backups or the executable migration history.

Requirements

  • Keep only the five newest *_snapshot.json files, ordered by their numeric migration prefix. If fewer than five exist, retain all of them. Always retain the newest snapshot.

  • Generate schema migrations with pnpm db:generate from the repository root. Its existing prune:snapshots step removes older snapshots. Commit those deletions with the generated migration; do not restore them to reduce the diff.

  • After a merge, rebase, cherry-pick, or migration renumbering, check the final combined snapshot set again. A branch that was correctly pruned before a merge can contain too many snapshots afterward. Run the existing command:

    pnpm --filter @paperclipai/db prune:snapshots
    
  • Pruning removes only old *_snapshot.json files. Preserve historical SQL migrations and every existing _journal.json entry. Do not rewrite retained snapshot contents or IDs as part of retention cleanup.

  • Include snapshot deletions in the same PR that adds snapshots. A separate cleanup PR may remove an existing excess without generating a new migration.

  • Before pushing, inspect the migration diff and run pnpm --filter @paperclipai/db check:migrations. Verify the retained snapshot names separately: the numbering check validates SQL files and journal entries, but does not enforce snapshot retention.

Examples and exceptions

If the checkout contains 0331 through 0338, retain 0334 through 0338 and delete snapshots 0331, 0332, and 0333. Adding snapshot 0339 then removes snapshot 0334. Multiple additions can require multiple deletions.

SQL-only migrations do not require an invented snapshot. Select the five newest existing snapshots; do not assume every journal entry has one. An unrelated PR does not need to repair historical snapshot retention.

Read the full file on GitHub · 60 lines

Changes

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.

  1. 2d ago First seen · 60 lines · 0 tokens per session scan A 6198e92a559b

Subscribe to this mod's changes

database-migration-snapshots is a cursor rule published in the GitHub repository paperclipai/paperclip (102,719 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 607 tokens. 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-10-14.