Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aj-geddes avatar

Database Migration Management

  • 452 installs
  • 305 repo stars
  • Updated March 4, 2026
  • aj-geddes/useful-ai-prompts

database-migration-management is an agent skill that plans safe PostgreSQL and MySQL schema migrations with versioning, rollback logs, and data transforms for developers evolving production databases without downtime.

About

database-migration-management is a prompt skill in aj-geddes/useful-ai-prompts for robust schema versioning across PostgreSQL and MySQL environments. The quick-start SQL defines schema_migrations and migration_logs tables plus a record_migration function tracking version, name, duration_ms, checksum, status, and rollback timestamps. Five reference guides cover adding columns, renaming columns, non-blocking index creation, data transformations, and table structure changes with production deployment patterns. Best practices emphasize reversible migrations, testing before production, and coordinated multi-environment rollouts while avoiding destructive changes without rollback plans. Developers reach for this skill when adding indexes online, backfilling columns, or designing migration frameworks for services that cannot tolerate schema drift between staging and production. Use it during schema reviews where deployment ordering, checksum validation, and rollback execution must be explicit before ALTER statements ship.

  • Forward and rollback migration scripts
  • Zero-downtime expansion strategies
  • Environment promotion and ordering rules
  • Data backfill and constraint safety checks
  • ORM and raw SQL migration patterns

Database Migration Management by the numbers

  • 452 all-time installs (skills.sh)
  • Ranked #130 of 911 Databases skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill database-migration-management

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs452
repo stars305
Last updatedMarch 4, 2026
Repositoryaj-geddes/useful-ai-prompts

How do you manage safe database schema migrations?

Plan, author, and roll forward or back schema migrations safely across environments while preserving data integrity and deployment ordering.

Who is it for?

Backend developers evolving PostgreSQL or MySQL production schemas who need migration tracking tables, rollback logs, and non-blocking change patterns.

Skip if: Greenfield prototypes with disposable SQLite databases and no production migration requirements should skip database-migration-management.

When should I use this skill?

User plans schema migrations, rollback strategies, index changes, or multi-environment database versioning for PostgreSQL or MySQL.

What you get

Versioned migration SQL files, schema_migrations tracking tables, rollback plans, and validated multi-environment deploy ordering.

  • Versioned migration SQL scripts
  • schema_migrations tracking schema
  • Documented rollback and deploy plan

By the numbers

  • Includes 5 reference guides in the references/ directory
  • Quick-start defines schema_migrations and migration_logs tracking tables

Files

SKILL.mdMarkdownGitHub ↗

Database Migration Management

Table of Contents

Overview

Implement robust database migration systems with version control, rollback capabilities, and data transformation strategies. Includes migration frameworks and production deployment patterns.

When to Use

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

Quick Start

Minimal working example:

-- Create migrations tracking table
CREATE TABLE schema_migrations (
  version BIGINT PRIMARY KEY,
  name VARCHAR(255) NOT NULL,
  executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  duration_ms INTEGER,
  checksum VARCHAR(64)
);

-- Create migration log table
CREATE TABLE migration_logs (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  version BIGINT NOT NULL,
  status VARCHAR(20) NOT NULL,
  error_message TEXT,
  rolled_back_at TIMESTAMP,
  executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Function to record migration
CREATE OR REPLACE FUNCTION record_migration(
  p_version BIGINT,
  p_name VARCHAR,
  p_duration_ms INTEGER
) RETURNS void AS $$
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Adding ColumnsAdding Columns
Renaming ColumnsRenaming Columns
Creating Indexes Non-blockingCreating Indexes Non-blocking
Data TransformationsData Transformations
Table Structure ChangesTable Structure Changes

Best Practices

✅ DO

  • Follow established patterns and conventions
  • Write clean, maintainable code
  • Add appropriate documentation
  • Test thoroughly before deploying

❌ DON'T

  • Skip testing or validation
  • Ignore error handling
  • Hard-code configuration values

Related skills

How it compares

Pick database-migration-management over generic SQL skills when migrations need explicit versioning tables, rollback logs, and non-blocking index strategies for production PostgreSQL or MySQL.

FAQ

Which databases does database-migration-management cover?

database-migration-management focuses on PostgreSQL and MySQL schema versioning, providing SQL for schema_migrations tracking, migration_logs status rows, and rollback timestamps during multi-environment deploys.

What reference guides ship with database-migration-management?

database-migration-management includes 5 references for adding columns, renaming columns, creating indexes non-blocking, data transformations, and broader table structure changes with production patterns.

Databasesdatabasespipelinesetl

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.