migrate

A command for managing database migrations, which are tracked changes to a database’s tables and structure. It supports creating migrations, applying them, rolling them back, and checking their status.

In plain words
What is it for?
Use it to create schema changes, apply pending migrations, roll back changes, and inspect migration status.
Why use it?
It keeps database changes ordered and provides a defined way to undo them when needed.

Command

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.

agentmods
npx agentmods add commands/cyperx84/claude-code-plugin-examples/migrate
Clone the repo
git clone --depth 1 https://github.com/cyperx84/claude-code-plugin-examples
Per session 4 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,844 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00004 $0.01844
Opus 5 $0.00002 $0.00922
Sonnet 5 $0.00001 $0.00369
Haiku 4.5 $0.00000 $0.00184

Measured yesterday against content hash 493f2577a099, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

migrate 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 yesterday.

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.

examples/04-real-world/database-plugin/commands/migrate.md · 369 lines

How it starts

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

Database Migration Management

Manage migrations: $ARGUMENTS (up, down, create, status)

Migration Commands

Create New Migration

/migrate create add_users_table

# Generates:
migrations/
└── 20241015120000_add_users_table.sql

# With content:
-- Migration: add_users_table
-- Created: 2024-10-15 12:00:00

-- Up Migration
CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  username VARCHAR(255) UNIQUE NOT NULL,
  email VARCHAR(255) UNIQUE NOT NULL,
  created_at TIMESTAMP DEFAULT NOW()
);

CREATE INDEX idx_users_email ON users(email);

-- Down Migration (Rollback)
DROP INDEX IF EXISTS idx_users_email;
DROP TABLE IF EXISTS users;

Run Migrations (Up)

/migrate up

# Process:
🔍 Checking migration status...
📊 Pending migrations: 3

Migration 1/3: add_users_table
  ✅ Creating users table... Done (45ms)
  ✅ Creating index... Done (12ms)
  ✅ Migration applied successfully

Migration 2/3: add_orders_table
  ✅ Creating orders table... Done (38ms)
  ✅ Adding foreign keys... Done (15ms)
  ✅ Migration applied successfully

Migration 3/3: add_email_verification
  ✅ Adding email_verified column... Done (8ms)
  ✅ Setting default values... Done (125ms)
  ✅ Migration applied successfully

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ All migrations applied successfully!
   Total time: 243ms
   Migrations run: 3

Rollback Migrations (Down)

/migrate down

# With confirmation:
⚠️  WARNING: Rolling back migration
   Migration: add_email_verification
   This will:
   - Drop email_verified column
   - Remove verification logic

   Data loss possible!

Confirm rollback? (yes/no): yes

Rolling back...
  ✅ Dropping column... Done
  ✅ Rollback complete

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Rolled back 1 migration

# Rollback specific number
/migrate down 2  # Rollback last 2 migrations

Check Migration Status

/migrate status

# Output:
Migration Status:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✅ Applied (5):
  1. 20241001120000_add_users_table
  2. 20241002140000_add_orders_table
  3. 20241003100000_add_products_table
  4. 20241010093000_add_inventory_table
  5. 20241015120000_add_email_verification

⏳ Pending (2):
  6. 20241016150000_add_payment_methods
  7. 20241017110000_add_shipping_addresses

Last migration: 2024-10-15 12:00:00
Database version: 5

Read the full file on GitHub · 369 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. yesterday First seen · 369 lines · 4 tokens per session scan A 493f2577a099

Subscribe to this mod's changes

migrate is a command published in the GitHub repository cyperx84/claude-code-plugin-examples (2 stars, last pushed 10mo ago), licensed MIT. It adds 4 tokens to every session and 1,844 once invoked, about $0.0000 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-31.