database-migration

Coordinate backward-compatible database migrations using expand-contract.

Updated Apr 8, 2026
One-click install
npx skills add https://github.com/s3nex-com/sdlc-skills-library --skill database-migration-s3nex-com
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-migration
Source: https://github.com/s3nex-com/sdlc-skills-library/tree/main/skills/phase2/database-migration
Command: npx skills add https://github.com/s3nex-com/sdlc-skills-library --skill database-migration-s3nex-com

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Schema changes are high-risk and can cause downtime, data loss, or rollback difficulties. This Skill provides a disciplined approach to planning, validating, and deploying migrations that remain backward-compatible and safely auditable across environments.

Core Features & Use Cases

  • Classification and safe deployment guidance: identify migration type (additive, subtractive, data) and apply expand-contract when reads or writes would be broken.
  • Expand-Contract pattern: guide through Stage 1 Expand, Stage 2 Migrate, and Stage 3 Contract to avoid production outages.
  • Pre-deployment, CI, and production readiness: checklists, staging validation, and documented rollback sequences to ensure safe rollouts.

Quick Start

Map the migration type, implement Stage 1 and Stage 2 in separate deployments, then verify health before Stage 3.

Frequently Asked Questions about database-migration

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

FAQPage Schema
How do I perform zero-downtime database schema migrations in production?

Zero-downtime database migrations use the expand-contract pattern across three stages: expand the schema, migrate backfill data, then contract by removing deprecated columns to prevent production outages.

What is the expand-contract pattern for backward-compatible schema changes?

The expand-contract pattern deploys schema changes in stages: first expand by adding new columns, then migrate existing data, and finally contract by removing obsolete structures to maintain backward compatibility.

How do I safely rollback a failed database migration deployment?

Safe database migration rollbacks require documented rollback sequences and pre-deployment checks, ensuring idempotent migration scripts can be reversed without data loss if staging validation fails.

When do I need to use expand-contract for reindexing or data backfills?

Expand-contract is needed for reindexing and data backfills when direct schema changes would break active reads or writes, requiring staged deployments to preserve application availability.

Can I use idempotent migration scripts for adding and removing columns?

Yes, idempotent migration scripts safely handle additive and subtractive schema changes like adding or removing columns, ensuring repeated executions do not corrupt database state across environments.

What are the limitations of zero-downtime migrations for complex data backfills?

Zero-downtime migrations require separating Stage 1 expand and Stage 2 migrate into separate deployments, meaning complex data backfills demand strict staging validation and health verification before final contraction.