CakePHP Migrations

Database migrations plugin for CakePHP to version, apply, and roll back schema changes from the CLI.

Tool
Composer
v5.2.6
134stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
80/100Excellent
Development Activity80
Maintenance84
Community84
Maturity60
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
75/100Good
Architecture82
Code Quality84
Innovation60
Learning Curve72

CakePHP Migrations is the official database migrations system for CakePHP applications. It lets teams describe schema changes as versioned migration classes and apply, roll back, or check their status through bin/cake commands, keeping database structure in sync across environments and developers.

Built on top of the Phinx migrations engine and integrated with CakePHP’s connection configuration, the plugin supports creating migrations by hand or generating them from existing schema, a fluent table-builder API for columns and indexes, seeding, and optional middleware that warns when pending migrations exist. It is the standard way to manage evolving database schemas in the CakePHP ecosystem.

What You Get

  • bin/cake migrations commands to create, apply, roll back, and inspect migration status.
  • A fluent table-builder API for defining columns, indexes, and constraints in migration classes.
  • Migration generation and schema diffing from an existing database.
  • Database seeding support and optional middleware that flags pending migrations.

Common Use Cases

  • Versioning database schema changes so they can be replayed across dev, staging, and production.
  • Coordinating schema changes across a team through migration files in source control.
  • Bootstrapping a new environment’s database to a known, reproducible structure.

Under The Hood

Architecture - The plugin lives under src/ and layers CakePHP-native commands (src/Command) over the Phinx migration engine, adapting Phinx’s AbstractMigration and table builder to CakePHP connection configuration; a Migrations service class exposes programmatic access, and middleware in the plugin checks for unapplied migrations. Tech Stack - PHP built on the Phinx library, integrated with CakePHP’s ORM/Datasource connections and the bin/cake console; the repo includes PHPStan, PHP_CodeSniffer, Rector, and PHPUnit configuration plus a Dockerfile for multi-database testing. Code Quality - The project is well tested against multiple database drivers, statically analyzed, and follows the CakePHP coding standard, consistent with an officially maintained plugin with regular releases. API Design - Migration classes use a readable change()/up()/down() structure with a chainable table builder, and the console commands mirror familiar migration workflows, making it approachable for developers already using CakePHP conventions.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search