migrate-create

Generate sequentially numbered database migration files with up and down SQL templates.

70.1k|8.4k|Updated Jun 2, 2025
One-click install
npx skills add https://github.com/ruvnet/claude-flow --skill migrate-create
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-create
Source: https://github.com/ruvnet/claude-flow/tree/main/plugins/ruflo-migrations/skills/migrate-create
Command: npx skills add https://github.com/ruvnet/claude-flow --skill migrate-create

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creating database migrations by hand is error-prone: numbering conflicts, missing rollback scripts, and inconsistent SQL templates slow down schema changes. This Skill automates the creation of properly numbered, reversible migration file pairs.

Core Features & Use Cases

  • Sequential Numbering: Scans the migrations directory with Glob to find the highest existing number and generates the next zero-padded 3-digit identifier.
  • Template Selection: Picks the right SQL template based on the migration name, covering CREATE TABLE, ALTER TABLE ADD COLUMN, DROP with safety checks, and CREATE INDEX patterns.
  • Idempotent SQL: Writes up migrations with IF NOT EXISTS and down migrations with IF EXISTS so migrations can be safely re-run.
  • Pattern Memory: Searches past migration patterns via AgentDB and stores migration metadata in memory for future reference.
  • Use Case: When adding a new users table to your project, invoke the skill with the name create_users to instantly get 001_create_users.up.sql and 001_create_users.down.sql with correct boilerplate.

Quick Start

Ask the assistant to create a new database migration named create_users using the migrate-create skill.

Frequently Asked Questions about migrate-create

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a new database migration file?

Invoke the skill with a descriptive name like create_users or add_email_column. It scans the migrations directory for the highest existing number, increments it with zero-padding, and writes matching up and down SQL files.

How are migration file numbers generated?

The skill uses Glob to list existing migration files, finds the highest numeric prefix, and increments it by one. Numbers are zero-padded to three digits, producing names like 007_add_index.up.sql.

What SQL templates does the migration generator support?

Templates are selected by name prefix: create_ produces CREATE TABLE, add_ produces ALTER TABLE ADD COLUMN, drop_ produces DROP with safety checks, and names containing index produce CREATE INDEX. Other names get a generic placeholder template.

Are the generated migrations reversible and idempotent?

Yes. Up migrations use IF NOT EXISTS and down migrations use IF EXISTS, so they can be applied or rolled back repeatedly without errors. Each migration pair includes a reverse operation for rollback.

Can I record migration metadata without the skill?

Yes, a CLI alternative is provided: run npx @claude-flow/cli@latest memory store with the migrations namespace, a migration key, and a JSON value containing the number, name, and pending status.