Agent skill · software engineering · jeremylongshore

managing-database-migrations

Process use when you need to work with database migrations.

Why this skill is useful

Adds detailed procedures and automation for managing database migrations across multiple databases, which the AI wouldn't reliably generate on its own.

What it needs

Requires alembic, flyway, knex, prisma installed locally. About 4k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

Database Migration Manager Overview Create, validate, and execute database schema migrations with full rollback support across PostgreSQL, MySQL, and MongoDB. Prerequisites Database credentials with DDL permissions (CREATE, ALTER, DROP TABLE) Migration framework installed and configured (Flyway, Alembic, Prisma, Knex, or raw SQL versioning) Version control for migration files (Git repository) Access to a staging database matching production schema for testing migrations psql or mysql CLI for executing and verifying migrations Current schema baseline documented or captured via pgdump --schema-only Instructions 1. Capture the current schema state before making changes. Run pgdump --schema-only -f schemabefore.sql (PostgreSQL) or mysqldump --no-data > schemabefore.sql (MySQL) to create a reference point. 2. Define the desired schema change clearly: specify table name, column additions/removals/modifications, constraint changes, and index updates. Document whether the change is additive (safe) or destructive (requires data migration). 3. Generate a versioned migration file following the framework's naming convention: Flyway: V20240115001addstatuscolumntoorders.sql Alembic: alembic revision --autogenerate -m "add status column to orders" Prisma: Edit schema.prisma then npx prisma migrate dev --name addstatustoorders Knex: npx knex migrate:make addstatustoorders 4. Write the UP migration (forward change) with these safety practices: Add new columns as nullable first, then backfill, then set NOT NULL Use IF NOT EXISTS for CREATE operations to make migrations idempotent Add explicit transaction wrapping: BEGIN; ... COMMIT; Include comments explaining the business reason for each change 5. Write the DOWN migration (rollback) that exactly reverses the UP migration. For column additions, the DOWN drops the column. For table renames, the DOWN renames back. For data transformations, the DOWN must restore original data (store it in a backup column or table if needed). 6. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/managing-database-migrations--47ffd3

View the source on GitHub

Browse the @skills marketplace