All skills
wshobson avatar

/database-migration

@be57c0b
by Seth Hobsonwshobson/agents40k stars
4,281

Execute database migrations across ORMs and platforms with zero-downtime strategies, data transformation, and rollback procedures. Use when migrating databases, changing schemas, performing data transformations, or implementing zero-downtime deployment strategies.

Use this Skill: https://skilld.dev/gh/wshobson/agents/database-migration

This session only. Nothing lands on disk.

referencesdetails.md

≈431 tokens on demand. Your agent reads this file only when SKILL.md points to it.

database-migration — additional patterns and templates

Zero-Downtime Migrations

Blue-Green Deployment Strategy

// Phase 1: Make changes backward compatible
module.exports = {
  up: async (queryInterface, Sequelize) => {
    // Add new column (both old and new code can work)
    await queryInterface.addColumn("users", "email_new", {
      type: Sequelize.STRING,
    });
  },
};

// Phase 2: Deploy code that writes to both columns

// Phase 3: Backfill data
module.exports = {
  up: async (queryInterface) => {
    await queryInterface.sequelize.query(`
      UPDATE users
      SET email_new = email
      WHERE email_new IS NULL
    `);
  },
};

// Phase 4: Deploy code that reads from new column

// Phase 5: Remove old column
module.exports = {
  up: async (queryInterface) => {
    await queryInterface.removeColumn("users", "email");
  },
};

Cross-Database Migrations

PostgreSQL to MySQL

// Handle differences
module.exports = {
  up: async (queryInterface, Sequelize) => {
    const dialectName = queryInterface.sequelize.getDialect();

    if (dialectName === "mysql") {
      await queryInterface.createTable("users", {
        id: {
          type: Sequelize.INTEGER,
          primaryKey: true,
          autoIncrement: true,
        },
        data: {
          type: Sequelize.JSON, // MySQL JSON type
        },
      });
    } else if (dialectName === "postgres") {
      await queryInterface.createTable("users", {
        id: {
          type: Sequelize.INTEGER,
          primaryKey: true,
          autoIncrement: true,
        },
        data: {
          type: Sequelize.JSONB, // PostgreSQL JSONB type
        },
      });
    }
  },
};

Source: SKILL.md on GitHub

No alerts16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill provides reference documentation and templates for database migrations across various Object-Relational Mapping (ORM) frameworks like Sequelize, TypeORM, and Prisma. It is completely safe and free from any security concerns.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    1 file scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at be57c0b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated 4 months ago
  • Database
  • migrations
  • sequelize
  • typeorm
  • prisma
  • schema
  • orm
  • zero-downtime
  • rollback
  • data-transformation

README badge

README badge for wshobson/agents/database-migration

Handles schema changes, data transformations, and rollbacks across Sequelize, TypeORM, and Prisma with zero-downtime strategies. Covers column additions, renames, type changes, complex data migrations, transactions, and backup-based rollback procedures.

Generated from the current SKILL.md.

Does this skill work with Sequelize, TypeORM, and Prisma?
Yes. The skill covers migration patterns for all three ORMs, including schema transformations, data migrations, and rollback procedures specific to each.
How does this skill handle zero-downtime migrations?
It demonstrates multi-step approaches like adding a new column, migrating data, updating the application, then dropping the old column — preventing downtime by never requiring simultaneous schema and code changes.
Does this skill support rolling back migrations?
Yes. It includes transaction-based rollbacks and checkpoint-based recovery patterns, including backup tables for complex migrations that need verification before commit.
Can this skill handle data transformations during migration?
Yes. It includes patterns for complex transformations like splitting a single address string into multiple columns, with both migration and rollback logic.
Does this skill cover column type changes?
Yes. It demonstrates safe multi-step type changes using intermediate columns and data casting, particularly for large tables where direct conversion could fail.

Generated from the current SKILL.md. These answers refresh after source changes.