Validate pending migrations for foreign key consistency, rollback safety, and best practices
Install
npx skills add https://github.com/ruvnet/ruflo --skill migrate-validateSKILL.md
Migrate Validate
Validate all pending database migrations for correctness, safety, and adherence to best practices.
When to use
Before applying migrations to catch issues early -- foreign key references to non-existent tables, missing rollback SQL, destructive operations without safeguards, and naming convention violations.
Steps
- Find pending migrations -- use
Globto list all migration files, cross-reference with applied history viamcp__plugin_ruflo-core_ruflo__memory_search --namespace migrations(ormemory_list) to identify pending ones. Thememory_*tool family routes by namespace;agentdb_hierarchical-*does NOT (it routes by tier), so usememory_*here. - Parse SQL -- use
Readto load each pending.up.sqland.down.sqlfile and parse the SQL statements - Check foreign keys -- verify that all REFERENCES targets exist in the current schema or in prior migrations (both applied and pending)
- Check NOT NULL defaults -- verify that any ADD COLUMN with NOT NULL has a DEFAULT value
- Check rollback completeness -- verify every CREATE/ALTER in the UP file has a corresponding DROP/ALTER in the DOWN file
- Flag destructive ops -- warn on DROP TABLE, DROP COLUMN, TRUNCATE without explicit confirmation
- Check idempotency -- verify IF EXISTS / IF NOT EXISTS is used for safety
- Check naming -- verify table names are plural, column names are snake_case, index names follow
idx_table_columnconvention - Store validation patterns -- two paths (per ruflo-cost-tracker ADR-0001 dual-path pattern):
- Pattern store (typed, recommended):
mcp__plugin_ruflo-core_ruflo__agentdb_pattern-storewithtype: 'migration-validation'. No namespace arg — ReasoningBank routes it. - Plain store (namespace-routable):
mcp__plugin_ruflo-core_ruflo__memory_store --namespace migrationsfor validation results tied to a specific migration number.
- Pattern store (typed, recommended):
- Report -- display: errors (must fix), warnings (should fix), info (suggestions), with file path and line number for each issue
CLI alternative
npx @claude-flow/cli@latest memory search --query "migration validation results" --namespace migrations
Related skills
azure-kustomicrosoft605KQuery and analyze data in Azure Data Explorer (Kusto/ADX) using KQL for log analytics, telemetry, and time series analysis. WHEN: KQL queries, Kusto database queries, Azure Data Explorer, ADX clusters, log analytics, time series data, IoT telemetry, anomaly detection.supabase-postgres-best-practicessupabase421KPostgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pg_cron, pgmq), vector/semantic search (pgvector), and restoring dumps (pg_restore) or imporprisma-database-setupprisma321KGuides for configuring Prisma with different database providers (PostgreSQL, MySQL, SQLite, MongoDB, etc.). Use when setting up a new project, changing databases, or troubleshooting connection issues. Triggers on "configure postgres", "connect to mysql", "setup mongodb", "sqlite setup".prisma-client-apiprisma320KPrisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".