{
  "markdown": "# db-migration-guard\n\nA Claude Code plugin that catches dangerous database migration patterns before they reach production.\n\n## What It Does\n\n- Detects destructive operations (dropping columns/tables, renames, type changes)\n- Warns about locking risks on large tables (non-concurrent indexes)\n- Suggests zero-downtime migration patterns (add/backfill/swap/drop)\n- Flags NOT NULL additions without defaults\n- Catches mixed data/schema migrations\n- Works across Rails, Django, Laravel, Prisma, and Knex\n\n## Installation\n\n```\n/plugin install db-migration-guard@claude-plugin-directory\n```\n\n## Usage\n\n### Automatic Protection (Hooks)\n\nThe plugin automatically intercepts migration file edits and warns about dangerous patterns. No action needed - it runs whenever you create or edit a migration file.\n\nDisable with the environment variable:\n\n```\nDISABLE_MIGRATION_GUARD=1\n```\n\n### Slash Command\n\nRun a full safety scan on all pending migrations:\n\n```\n/migrate-check\n/migrate-check db/migrate\n/migrate-check prisma/migrations\n```\n\n### Skill (Auto-Activated)\n\nThe `migrate-check` skill activates automatically when you discuss migration safety, schema changes, or database operations. It provides contextual guidance inline.\n\n### Agent\n\nThe `migration-reviewer` agent performs deep analysis - cross-referencing schema files, checking foreign key dependencies, and estimating table sizes to provide risk-aware recommendations.\n\n## Supported Frameworks\n\n| Framework | Migration Path | Schema File |\n|---|---|---|\n| Rails | `db/migrate/*.rb` | `db/schema.rb` |\n| Django | `app/migrations/*.py` | `models.py` |\n| Laravel | `database/migrations/*.php` | - |\n| Prisma | `prisma/migrations/*.sql` | `schema.prisma` |\n| Knex | `migrations/*.js` | - |\n\n## Risk Levels\n\n- **SAFE** - Adding nullable columns, new tables, concurrent indexes\n- **WARNING** - NOT NULL without default, non-concurrent indexes, type changes on small tables\n- **DANGEROUS** - Dropping columns/tables, renames, type changes on large tables, removing indexes\n\n## Examples\n\n### Dangerous: Dropping a column\n\n```ruby\n# This triggers a DANGEROUS warning\nclass RemoveEmailFromUsers < ActiveRecord::Migration[7.0]\n  def change\n    remove_column :users, :email, :string\n  end\nend\n```\n\nSuggested safe alternative:\n\n```ruby\n# Step 1: Stop writing (app code change, no migration)\n# Step 2: Stop reading (app code change, no migration)\n# Step 3: Remove the column\nclass RemoveEmailFromUsers < ActiveRecord::Migration[7.0]\n  def change\n    safety_assured { remove_column :users, :email, :string }\n  end\nend\n```\n\n### Warning: Non-concurrent index\n\n```ruby\n# This triggers a WARNING\nclass AddIndexToOrders < ActiveRecord::Migration[7.0]\n  def change\n    add_index :orders, :customer_id\n  end\nend\n```\n\nSuggested fix:\n\n```ruby\nclass AddIndexToOrders < ActiveRecord::Migration[7.0]\n  disable_ddl_transaction!\n\n  def change\n    add_index :orders, :customer_id, algorithm: :concurrently\n  end\nend\n```\n\n## License\n\nMIT\n",
  "bytes": 2958,
  "sha": "d6e4ae716c25d4249e25ce72a946cdf3576ead53dd87a5d1ba86834d2da02bb9",
  "repo_slug": "a-abdellatif98/db-migration-guard",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_a_abdellatif98_db_migration_guard_db_mig_d2daebb1/readme"
}