execute-database-migration · git:20260909.094cff3 · 2026-09-09 · sha256 77336dc5e2235d1b

execute-database-migration git:20260909.094cff3A

Immutable. This exact content never changes and is served at /api/v1/blob/77336dc5e2235d1b.

No tool to install first
claude plugin marketplace add https://markdownregistry.com/mp/a/art_krryc5b4tweesjmn/77336dc5e2235d1b1e3841eed8480be479f87c6eee60da2278610e8538fc3fdb.json

Then /plugin install execute-database-migration@markdownregistry-krryc5b4tweesjmn in Claude Code. It installs this exact version, the one graded A here, pinned to the commit it was graded at, and leaves it there.

---
name: execute-database-migration
user-invocable: false
description: "Use when planning, validating, testing, executing, or rolling back a database schema migration. Defaults to read-only validation and dry-run behavior; production mutation requires explicit confirmation and a recovery plan."
---

# Execute Database Migration

Implement `database.md` and `disaster-recovery.md` as a safe migration workflow.

## Parameters

- `database`: target identifier; never require a secret in chat.
- `migrationsPath`: default `db/migrations/`.
- `currentVersion`, `targetVersion`: detected unless supplied.
- `mode`: `validate`, `plan`, `test`, `execute`, or `rollback`; default `validate`.
- `dryRun`: default `true`.
- `backupRequired`: default `true` for execute and rollback.
- `checkBackwardCompatibility`: default `true`.
- `timeout`: default `30m`.
- `format`: `summary` or `json`; default `summary`.

## Workflow

1. Detect the migration framework and current schema version.
2. Validate syntax, ordering, checksums, permissions, and dependencies.
3. Analyze expand/migrate/contract compatibility with old and new application versions.
4. Test against representative sanitized data where possible.
5. For execute, require confirmation, verify backup/recovery readiness, apply the
   reviewed migration, and run schema and application smoke checks.
6. For rollback, prefer a tested down migration or restore procedure; report when
   rollback is impossible or destructive.

## Safety

- Never ask for or print database credentials.
- Never execute against production without explicit confirmation.
- Do not claim rollback support unless it has been verified.
- Capture timing, locks, affected rows, and validation results without sensitive data.

## Output

Return current and target versions, schema changes, compatibility findings,
backup status, execution status, smoke checks, rollback limits, and next steps.