Get the FREE Ultimate OpenClaw Setup Guide →

data-migration

npx machina-cli add skill Microck/ordinary-claude-skills/data-migration --openclaw
Files (1)
SKILL.md
1.7 KB

Data Migration - Safe Schema Changes

When to use this skill

  • Migrating database schemas and structures
  • Transforming data between formats
  • Moving data between database systems
  • Implementing versioned database migrations
  • Handling data transformations during migrations
  • Ensuring data integrity and validation
  • Planning zero-downtime migrations
  • Rolling back failed migrations safely
  • Migrating from legacy systems
  • Implementing data backfill strategies
  • Testing migrations in staging environments
  • Creating migration rollback procedures

When to use this skill

  • Migrating data between schemas, zero-downtime deployments.
  • When working on related tasks or features
  • During development that requires this expertise

Use when: Migrating data between schemas, zero-downtime deployments.

Process

  1. Add new column
  2. Dual-write to old & new
  3. Backfill historical data
  4. Switch reads to new column
  5. Remove old column

Example

```sql -- Step 1: Add column ALTER TABLE users ADD COLUMN email_new VARCHAR(255);

-- Step 2: Backfill UPDATE users SET email_new = email WHERE email_new IS NULL;

-- Step 3: Swap ALTER TABLE users DROP COLUMN email; ALTER TABLE users RENAME COLUMN email_new TO email; ```

Resources

Source

git clone https://github.com/Microck/ordinary-claude-skills/blob/main/skills_all/data-migration/SKILL.mdView on GitHub

Overview

This skill covers planning and executing database migrations, including schema changes and data transformations, with rollback strategies and data integrity validation. It emphasizes zero-downtime considerations, versioned migrations, and safe backfills to migrate between systems while preserving data accuracy.

How This Skill Works

Implement migrations by adding a new column, dual-writing to both old and new schemas, and backfilling historical data. Then switch reads to the new column and remove the old one, all while validating data integrity and having a rollback plan ready for failures.

When to Use It

  • Migrating database schemas and structures
  • Transforming data between formats
  • Moving data between database systems
  • Planning zero-downtime migrations
  • Testing migrations in staging environments

Quick Start

  1. Step 1: Add new column
  2. Step 2: Backfill data and dual-write to old & new
  3. Step 3: Switch reads to the new column and remove the old column

Best Practices

  • Define versioned migrations and maintain a changelog
  • Backfill in controlled batches with progress tracking
  • Validate data integrity after each step
  • Test end-to-end in staging before production
  • Prepare robust rollback procedures and monitoring

Example Use Cases

  • Add a new column email_new and backfill data, then swap to the new column
  • Backfill historical data into the new column during migration
  • Use dual-write to old and new schemas to enable zero-downtime migration
  • Switch reads to the new column after backfill to complete the migration
  • Drop the old column after verification and rollback plan is ready

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers