Doctrine Migrations
PHP library for versioning and applying incremental database schema changes as migration classes
Repository Health
Technical Analysis
Doctrine Migrations is a PHP library, built on Doctrine DBAL, for managing database schema changes over time. It represents each change as a versioned migration class with up and down methods, and provides a command-line tool to generate, execute, and roll back those migrations in a controlled, repeatable way.
It tracks which migrations have run using a metadata table, supports generating diffs against your current schema, and integrates with Symfony and other frameworks through the Doctrine ecosystem, making database schema evolution safe to version-control and deploy.
What You Get
- A command-line tool to generate, run, roll back, and inspect migrations
- AbstractMigration base class with up() and down() lifecycle methods
- Automatic diff generation against your current Doctrine schema
- A metadata storage table that tracks executed migration versions
- Configurable finders, repositories, and a dependency-injection factory for framework integration
Common Use Cases
- Versioning database schema changes alongside application code
- Generating migration diffs from Doctrine ORM entity mappings
- Applying and rolling back schema changes across dev, staging, and production
- Coordinating database updates in CI/CD deployment pipelines
Under The Hood
Architecture - The library centers on a Migrator (Migrator.php / DbalMigrator.php) that executes ordered Version objects, each wrapping an AbstractMigration subclass; a MigrationsRepository (FilesystemMigrationsRepository) discovers migration files via a Finder, Metadata storage tracks executed versions, and a Generator plus SchemaDumper produce new migration classes from schema diffs, all wired together by a DependencyFactory.
Tech Stack - Written in modern PHP on top of Doctrine DBAL, distributed through Composer, with a bin/doctrine-migrations console entry point built on Symfony Console; quality tooling includes PHPStan, PHP_CodeSniffer, and a phpunit suite, and a box.json-driven PHAR build.
Code Quality - The codebase is well-structured into focused namespaces (Configuration, Metadata, Provider, Query, Generator, Version), carries a comprehensive tests/ suite, static analysis config (phpstan.neon.dist), coding-standard rules (phpcs.xml.dist), and documented upgrade paths (UPGRADE.md), reflecting a mature, professionally maintained project.
API Design - Users subclass AbstractMigration and implement up()/down() with a fluent schema API, then drive everything through clearly named CLI commands (migrations:generate, migrate, diff, rollup). The DependencyFactory makes deep customization possible, though the flexibility adds some configuration surface for advanced setups.
Used by 2 apps in this directory
Shlink
Developer Tools · Marketing
Self-hosted PHP URL shortener with a full REST API, dynamic redirect rules, and real-time visit analytics under your own domain.
wallabag
Bookmarks Archiving
Self-hosted read-it-later app that saves clean, ad-free articles from any webpage for distraction-free reading across all your devices.