Command Palette

Search for a command to run...

Назад к скиллам
скилл № 37267

database-migration

Use when the user asks about schema migrations, Flyway, Liquibase, Alembic, Prisma Migrate, zero-downtime expand/contract changes, AWS DMS, heterogeneous…

БесплатноБез исполняемых скриптов
j4flmaoот j4flmao★ 47 звёзд на GitHub

Установить database-migration в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Database Migration

Purpose

Plan and execute database migrations including schema changes, cross-engine migration, zero-downtime deployments, and rollback strategies.

Agent Protocol

Trigger

"database migration", "schema migration", "Flyway", "Liquibase", "Alembic", "AWS DMS", "gh-ost", "zero-downtime migration".

Input Context

Source/target engines and versions, data size, write rate, downtime tolerance, migration tool already in use.

Output Artifact

Migration scripts and step-by-step plan with rollback. No file unless requested.

Response Format

Type: {schema change|engine migration} {online|offline}
Tool: {Flyway|Liquibase|Alembic|gh-ost|pt-osc|DMS|...}
Steps: {expand -> migrate -> contract}
Rollback: {plan}
Script: {SQL/config}

Architecture Decision Trees

Online vs Offline Migration

Factor Offline Online (CDC)
Downtime Hours (full lock) Minutes or zero
Complexity Low High
Data volume Any Any
Consistency Guaranteed (locked) Eventual (CDC catch-up)
Rollback Snapshot restore Reverse CDC
Tooling pg_dump/mysqldump DMS, Debezium, GoldenGate
Best for <50GB, maintenance window Large DBs, 24/7 apps

Schema Migration Tool Comparison

Tool Language Versioning Rollback CI/CD Best For
Flyway Java/SQL Sequential files Undo (limited) Excellent Java shops, simple
Liquibase Java/XML/YAML/JSON Changelog tracking rollback Excellent Complex, multi-DB
Alembic Python Auto-generation downgrade() Good Python/Flask apps
Prisma Migrate TypeScript Shadow DB migration down Good Node.js/TS apps
Sqitch Perl Tag-based revert Good Multi-language teams
goose Go Sequential down Good Go services
gormigrate Go Migration structs Rollback Medium Go + GORM apps

Tool Selection Decision

What language does the application use?
├── Java/JVM → Flyway (simplest) or Liquibase (complex, multi-DB)
├── Python → Alembic (SQLAlchemy-native)
├── TypeScript/Node.js → Prisma Migrate (type-safe, shadow DB)
├── Go → goose (best tooling) or gormigrate (if using GORM)
└── Multi-language → Sqitch (tag-based, language-agnostic)

Need rollback support?
├── Yes → Liquibase (best rollback), Alembic (downgrade), or goose (down)
├── No → Flyway (forward-only, simpler)

Homogeneous vs Heterogeneous Migration

Type Source → Target Tooling Complexity
Homogeneous PostgreSQL → RDS PostgreSQL pg_dump + pg_restore / DMS Low
Homogeneous MySQL → RDS MySQL mysqldump / DMS Low
Heterogeneous Oracle → PostgreSQL Ora2Pg, DMS, AWS SCT High (type mapping)
Heterogeneous SQL Server → PostgreSQL Babelfish, DMS + SCT High
Heterogeneous Oracle → Aurora AWS SCT + DMS High
Heterogeneous MongoDB → DocumentDB DMS Medium
Heterogeneous Cassandra → DynamoDB Custom ETL Very High
Homogeneous SQL Server → Azure SQL Azure DMS Low-Medium

Zero-Downtime Migration Strategies

Strategy Downtime Complexity Best For
Expand-Migrate-Contract Zero Medium Adding columns, tables
Online schema change (gh-ost) Near-zero Medium DDL on large MySQL
Blue/Green (replica promote) Seconds High Full engine migration
Trigger-based sync Seconds High Cross-engine replication
Expand-Contract with feature flags Zero Medium Application-level changes
Parallel run (dual-write) Zero Very High High-risk migrations
Shadow table Minutes Medium Large table schema changes

Migration Strategy Decision

Can the application tolerate downtime?
├── Yes → Offline migration (simpler, faster, less risky)
│   ├── Data < 50GB → pg_dump/mysqldump
│   └── Data > 50GB → DMS full load
└── No → Online/zero-downtime migration
    ├── Same DB engine?
    │   ├── Yes → Replica promote (Blue/Green)
    │   └── No → CDC-based (DMS, Debezium)
    └── Schema-only change?
        ├── Yes → Expand-Migrate-Contract
        └── No → gh-ost (MySQL) or shadow table (PG)

Quick Start

Assessment → Schema migration tool setup → Forward-only migration script → Test on staging → Backup → Execute migration → Verify → Handle rollback if needed.

Core Workflow

Step 1: Flyway Migration

-- sql/migrations/V1_001__create_users_table.sql
-- Flyway naming: V{version}__{description}.sql
CREATE TABLE users (
    id BIGSERIAL PRIMARY KEY,
    email VARCHAR(255) NOT NULL UNIQUE,
    password_hash VARCHAR(255) NOT NULL,
    display_name VARCHAR(100) NOT NULL,
    role VARCHAR(20) NOT NULL DEFAULT 'user',
    is_active BOOLEAN NOT NULL DEFAULT true,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX idx_users_email ON users (email);
CREATE INDEX idx_users_role ON users (role);
-- sql/migra
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/database-migration-advanced.md
  • references/database-migration-fundamentals.md
  • references/migration-strategies.md
  • references/migration-tools.md
  • references/online-migration.md
  • references/schema-migration-tools.md
  • references/schema-migration.md
  • references/zero-downtime.md

FAQ

Что делает скилл database-migration?

Use when the user asks about schema migrations, Flyway, Liquibase, Alembic, Prisma Migrate, zero-downtime expand/contract changes, AWS DMS, heterogeneous database moves, or schema drift. Produces safe migration scripts, rollout order and validation. Not for whole-workload cloud migration (use cloud-migration).

Как установить скилл database-migration?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл database-migration запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить database-migration с