db-migration-safety

Evaluates database migration scripts for lock risks and destructive SQL operations.

9|3|Updated Jun 13, 2026
One-click install
npx skills add https://github.com/Sir-chawakorn/sanook-cli --skill db-migration-safety-sir-chawakorn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: db-migration-safety
Source: https://github.com/Sir-chawakorn/sanook-cli/tree/main/skills/db-migration-safety
Command: npx skills add https://github.com/Sir-chawakorn/sanook-cli --skill db-migration-safety-sir-chawakorn

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill prevents critical production database failures by identifying dangerous schema changes, lock-heavy operations, and destructive commands before they are executed.

Core Features & Use Cases

  • Risk Classification: Automatically categorizes SQL statements into additive, lock-risky, or destructive operations.
  • Safety Guardrails: Enforces best practices like batching backfills, using concurrent index builds, and implementing expand-contract patterns for schema changes.
  • Use Case: Before running a migration that adds a NOT NULL constraint to a table with millions of rows, use this skill to verify that the operation will not lock the table and cause application downtime.

Quick Start

Analyze the migration file located at migrations/20231027_add_user_index.sql for potential locking risks and destructive operations.

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 database migration scripts for lock contention and data loss risks?

To check database migration scripts for lock contention, you evaluate SQL statements to classify operations as additive, lock-risky, or destructive, verifying non-blocking execution strategies to prevent production outages.

What causes blocking DDL and table locks when adding a NOT NULL constraint in PostgreSQL?

Blocking DDL and table locks occur when adding a NOT NULL constraint to a large table because the operation holds an exclusive lock, requiring expand-contract patterns or batched backfills to maintain high availability.

How can I prevent production database outages during schema changes?

Preventing production database outages during schema changes requires enforcing safety guardrails like batching backfills, using concurrent index builds, and implementing expand-contract patterns to avoid destructive operations.

Does this database migration safety analysis work with standard SQL migration files?

Yes, this database migration safety analysis works by systematically classifying SQL statements within your migration files, making it applicable to schema design and deployment workflows using standard SQL.

What are the limitations of analyzing database migrations for high availability?

Analyzing database migrations for high availability requires systematic classification of SQL statements, meaning complex or obfuscated scripts may need manual verification to ensure non-blocking execution strategies are correctly identified.