본문으로 건너뛰기
cccskills
무료GitHub에 공개

migration-management

Manage database migrations and schema versioning. Use when planning migrations, version control, rollback strategies, or data transformations for any database paradigm.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md6.5 KB
  • references/relational.md4.5 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Database Migration Management

Overview

Implement robust database migration systems with version control, rollback capabilities, and data transformation strategies. This skill covers universal migration methodology. For paradigm-specific tooling, see references.

When to Use

  • Schema versioning and evolution
  • Data transformations and cleanup
  • Adding/removing tables, columns, collections, or fields
  • Index creation and optimization
  • Migration testing and validation
  • Rollback planning and execution
  • Multi-environment deployments

Paradigm-Specific References

After reading the methodology below, read the reference matching your surface's Databases column in the surface stack map (.agents/instructions/tech-stack.md):

ParadigmReferenceExample Stores
Relationalreferences/relational.mdPostgreSQL, MySQL, SQLite
Documentreferences/document.mdMongoDB, Firestore, CouchDB
Graphreferences/graph.mdSurrealDB, Neo4j, ArangoDB

Universal Migration Principles

1. Bidirectional Migrations

Every migration must have both directions:

  • UP — applies the change
  • DOWN — reverses the change

If a migration cannot be reversed (e.g., data deletion), document this explicitly and require a backup before execution.

2. Migration Ordering

Migrations are sequentially ordered by timestamp or version number:

  • Timestamp format: YYYYMMDD_NNN_description (e.g., 20240115_001_add_phone_to_users)
  • Never reorder or renumber existing migrations
  • Never modify an already-executed migration — create a new one

3. Idempotency

Migrations should be idempotent where possible:

  • Use "IF NOT EXISTS" / "IF EXISTS" guards
  • Check for the presence of the change before applying it
  • Run pre-flight checks before destructive operations

4. Atomic Migrations

Each migration should be a single logical change:

  • One migration = one purpose (add column, create table, transform data)
  • Don't combine unrelated changes
  • Use transactions for multi-statement migrations where supported

Common Migration Patterns

Safe Schema Changes

OperationSafe?Strategy
Add nullable column✅ Always safeAdd with default or NULL
Add NOT NULL column⚠️ Requires backfillAdd nullable → backfill → add constraint
Rename column⚠️ Requires coordinationAdd new → copy data → update app → drop old
Drop column⚠️ Requires coordinationStop reading → deploy → drop column
Add index⚠️ Can lock tableUse concurrent/online index creation
Drop table🔴 DestructiveBackup first, confirm no references

Multi-Phase Migrations

For non-trivial schema changes (rename, type change, restructure):

  1. Phase 1: Expand — Add new structure alongside old
  2. Phase 2: Migrate — Copy/transform data to new structure
  3. Phase 3: Contract — Remove old structure after verification

This pattern prevents downtime and allows rollback at any phase.

Data Transformation Migrations

When transforming data (normalization, cleanup, format changes):

  1. Verify source data — Count records, check constraints
  2. Apply transformation — Batch for large datasets
  3. Validate results — Compare counts, spot-check values
  4. Document irreversibility — If rollback requires backup restore, say so

Rollback Strategies

Per-Migration Rollback

Every migration has a DOWN direction. Execute in reverse order:

  • Migration 5 DOWN
  • Migration 4 DOWN
  • Migration 3 DOWN
  • ... until target version reached

Point-in-Time Recovery

For data-destructive migrations:

  • Require backup before execution
  • Document the backup location
  • Test restore procedure before migration

Blue-Green Schema Changes

For zero-downtime migrations:

  • Run new schema alongside old
  • Application supports both schemas during transition
  • Cut over when new schema is verified
  • Drop old schema after observation period

Testing Migrations

Local Testing

  1. Fresh database — Run all migrations from scratch (empty → current)
  2. Incremental — Run only new migrations on a copy of production
  3. Rollback — Test DOWN migration after UP
  4. Data integrity — Verify constraints hold after migration

Staging Validation

  1. Restore production backup to staging
  2. Run migrations on staging
  3. Verify application works against migrated schema
  4. Run automated tests against staging
  5. Record migration timing for capacity planning

Pre-Production Checklist

  • Tested on local database
  • Tested on staging with production data copy
  • Rollback procedure tested
  • Backup verified before migration
  • Application code compatible with both old and new schema
  • Migration timing measured (acceptable for maintenance window?)
  • Long-running query impact assessed

Production Deployment

Safe Migration Checklist

  • Test migration on production-like database
  • Verify backup exists before migration
  • Schedule during low-traffic window
  • Monitor locks and long-running queries
  • Have rollback plan ready and tested
  • Document all changes
  • Run in transaction when possible
  • Verify data integrity after migration
  • Coordinate application code deployment with migration
  • Notify team of migration window

Post-Migration Verification

  1. Schema check — Verify new structures exist
  2. Data check — Verify data integrity constraints
  3. Application check — Verify application reads/writes correctly
  4. Performance check — Verify query performance hasn't degraded
  5. Monitoring — Watch error rates for 24 hours post-migration

Migration Tracking

Maintain a migration history table (or equivalent) that records:

  • Migration version/ID
  • Migration name/description
  • Execution timestamp
  • Duration
  • Checksum (to detect tampering)
  • Status (applied, rolled back, failed)

Resources

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Audit and improve web accessibility following WCAG 2.1 guidelines. Use when asked to "improve accessibility", "a11y audit", "WCAG compliance", "screen reader support", "keyboard navigation", or "make accessible".

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

RepairYourTech/cfsa-antigravity62026년 8월 16일 업데이트

Structured methodology for adversarial thinking — generating attack scenarios, abuse cases, race conditions, and security edge cases against specs and implementations. Produces spec-level gap items, not code-level fixes.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

RepairYourTech/cfsa-antigravity62026년 8월 16일 업데이트

Orchestrate multiple Antigravity skills through guided workflows for SaaS MVP delivery, security audits, AI agent builds, and browser QA.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

RepairYourTech/cfsa-antigravity62026년 8월 16일 업데이트

Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use when designing new APIs, reviewing API specifications, or establishing API design standards.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

RepairYourTech/cfsa-antigravity62026년 8월 16일 업데이트

Manage API versioning and evolution with URL/header/query strategies, deprecation workflows, breaking change classification, sunset headers, and consumer-driven contract testing. Use when designing versioning strategy, deprecating endpoints, or evolving API contracts.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

RepairYourTech/cfsa-antigravity62026년 8월 16일 업데이트

Analyzes codebase structure, data flow, module relationships, and key patterns to generate and maintain a living architecture document (ARCHITECTURE.md).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

RepairYourTech/cfsa-antigravity62026년 8월 16일 업데이트

RepairYourTech의 스킬 모두 보기

이 스킬의 문제 신고