migrate-validate

Validates pending database migrations for foreign key consistency, rollback safety, and naming conventions.

70.1k|8.4k|Updated Jun 2, 2025
One-click install
npx skills add https://github.com/ruvnet/claude-flow --skill migrate-validate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-validate
Source: https://github.com/ruvnet/claude-flow/tree/main/plugins/ruflo-migrations/skills/migrate-validate
Command: npx skills add https://github.com/ruvnet/claude-flow --skill migrate-validate

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Applying unchecked database migrations can break production schemas through dangling foreign keys, missing rollback SQL, or destructive operations without safeguards. This Skill audits every pending migration before it runs, catching errors early.

Core Features & Use Cases

  • Pending Migration Detection: Cross-references migration files on disk with applied history stored in memory namespaces to identify what has not yet run.
  • SQL Safety Checks: Parses .up.sql and .down.sql files to verify foreign key targets exist, NOT NULL columns have defaults, and every CREATE/ALTER has a matching rollback statement.
  • Convention & Risk Reporting: Flags destructive operations (DROP TABLE, TRUNCATE), missing IF EXISTS guards, and naming violations, then reports errors, warnings, and suggestions with file paths and line numbers.
  • Use Case: Before deploying a release, run the validation to confirm that a new migration adding a NOT NULL column includes a DEFAULT value and that its DOWN file fully reverses the UP changes.

Quick Start

Validate all pending database migrations in this project and report any foreign key, rollback, or naming issues before I apply them.

Frequently Asked Questions about migrate-validate

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

FAQPage Schema
How do I validate database migrations before applying them?

Run the validation workflow to parse each pending .up.sql and .down.sql file, checking foreign key targets, NOT NULL defaults, and rollback completeness. It reports errors, warnings, and suggestions with file paths and line numbers.

How to check if a migration has a safe rollback script?

The validation compares every CREATE or ALTER statement in the UP file against corresponding DROP or ALTER statements in the DOWN file. Any migration lacking a complete rollback is flagged as an error to fix before deployment.

What issues does migration validation catch in SQL files?

It catches foreign keys referencing non-existent tables, NOT NULL columns without DEFAULT values, destructive operations like DROP TABLE or TRUNCATE without confirmation, missing IF EXISTS guards, and naming convention violations.

Does migration validation work with pending migrations only?

Yes, it cross-references migration files on disk with applied history stored in the migrations memory namespace to identify pending ones. Already-applied migrations are excluded from the validation pass.

Why does my migration fail foreign key validation?

A REFERENCES clause fails validation when its target table does not exist in the current schema or in any prior migration, whether applied or pending. Create the referenced table first or reorder the migration sequence.