db-migration-safety

Analyze SQL migration scripts for reversibility, lock levels, and destructive operations.

18|4|Updated Jun 16, 2026
One-click install
npx skills add https://github.com/Hainrixz/claude-db --skill db-migration-safety
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: db-migration-safety
Source: https://github.com/Hainrixz/claude-db/tree/main/skills/db-migration-safety
Command: npx skills add https://github.com/Hainrixz/claude-db --skill db-migration-safety

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps identify potential issues and risks in database migrations, ensuring safe and successful migrations.

Core Features & Use Cases

  • Reversibility Check: Ensures migrations are reversible with a proper down migration path.
  • Lock Level Analysis: Checks for potential locking issues that could impact database performance.
  • Table Rewrite Assessment: Identifies changes that require full table rewrites, which can be resource-intensive.
  • Destructive Operation Detection: Flags destructive operations like DROP COLUMN/TABLE, TRUNCATE, and NOT NULL changes without default values.
  • Enum Mutation Verification: Ensures enum changes do not remove or reorder values, avoiding potential data integrity issues.
  • Schema Drift Detection: Identifies discrepancies between the declarative schema and migration history.
  • Use Case: Before deploying a database migration, use this Skill to analyze it for potential issues, reducing the risk of failed migrations and data corruption.

Quick Start

Analyze the migration file 'migration.sql' for potential issues with the db-migration-safety skill.

Frequently Asked Questions about db-migration-safety

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check if my SQL migration script is reversible?

To check if an SQL migration script is reversible, a static analysis tool evaluates the migration to ensure a proper down migration path exists, preventing failed rollbacks.

How do I detect destructive database operations in migration files?

Detecting destructive database operations in migration files requires static analysis to flag SQL commands like DROP COLUMN, TRUNCATE, and NOT NULL changes without default values.

What causes schema drift between declarative schema and migration history?

Schema drift between declarative schema and migration history is caused by discrepancies when manual database changes bypass tracked migration scripts, which static analysis can identify.

Does static analysis detect lock level concerns in SQL migrations?

Yes, static analysis detects lock level concerns in SQL migrations by checking for potential locking issues and table rewrites that could impact database performance.

Why do enum mutations cause data integrity issues during database migration?

Enum mutations cause data integrity issues during database migration when values are removed or reordered, which static analysis verifies against to avoid breaking existing data references.

What is the best way to analyze SQL migrations without causing table rewrites?

The best way to analyze SQL migrations for table rewrites is using static analysis to identify resource-intensive full table rewrites and locking issues before deployment.