ecto-migration-helper

Create and execute Ecto migrations with rollback support in Elixir projects.

10|2|Updated Oct 24, 2025
One-click install
npx skills add https://github.com/mkreyman/bmad-elixir --skill ecto-migration-helper
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ecto-migration-helper
Source: https://github.com/mkreyman/bmad-elixir/tree/main/priv/skills/ecto-migration-helper
Command: npx skills add https://github.com/mkreyman/bmad-elixir --skill ecto-migration-helper

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you create, manage, and safely run Ecto migrations with proper rollback handling and best practices, reducing risk during schema changes.

Core Features & Use Cases

  • Generate Migrations: Create new migrations with recommended naming.
  • Migration Patterns: Examples for adding/removing columns, foreign keys, indexes, and constraints.
  • Safe Rollbacks: Guidance on reversible vs non-reversible changes and data migrations.

Quick Start

Use mix ecto.gen.migration to create a migration, then apply it with mix ecto.migrate.

Frequently Asked Questions about ecto-migration-helper

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

FAQPage Schema
How do I create safe database migrations with proper rollback support in Ecto?

Ecto migrations require defining both up and down functions to enable safe rollbacks. This Skill automates migration generation with best-practice patterns for reversible schema changes, including proper handling of defaults, NOT NULL constraints, foreign keys, and composite indexes.

What's the best way to handle data migrations in PostgreSQL with Ecto?

Data migrations in Ecto should use batched updates to avoid locking large tables and maintain reversibility. This Skill provides guidance on safe patterns for data transformations, ensuring your down function can undo changes and your application handles both old and new states during rollout.

Can I safely add or remove columns and constraints in Ecto migrations?

Yes. Ecto migrations support adding and removing columns, indexes, and constraints, but some operations—like removing columns with data—are non-reversible. This Skill teaches which changes are safely reversible and how to structure migrations to maximize rollback compatibility.

How do I avoid common pitfalls when adding foreign keys and indexes in migrations?

Foreign keys and composite indexes require careful ordering and constraint definition to avoid conflicts and performance issues. This Skill provides recommended patterns for declaring foreign keys, building indexes safely, and ensuring migrations apply cleanly across environments.

What makes a migration reversible versus non-reversible in Ecto?

Reversible migrations preserve data and schema state in both directions—your down function fully undoes the up function. Destructive operations like dropping columns or data loss are non-reversible. This Skill clarifies which operations support rollback and how to structure alternatives when rollback support is critical.