Skip to content
CAI
Software that uses CAICheck a score

doctrine/migrations

55.4

Adequate · 19 September 2026

7.3k

lines of production code

PHP

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a database schema migration library that manages versioned changes to database structures. It provides tools to generate, execute, and track migration scripts, supporting multiple configuration formats and database connections via Doctrine DBAL. The system includes CLI commands for diffing schemas, executing migrations, and inspecting status, while ensuring transactional integrity and providing detailed metadata storage for executed changes.

Features

Initial project scaffolding and configuration

The repository is initialized with essential configuration files including a PHPUnit XML configuration, PHPStan level 8 settings, PHPCS rules, and a Box PHAR build definition. It also includes a GitHub Actions CI workflow, an AppVeyor configuration for Windows testing, and standard documentation files such as a README, LICENSE, and SECURITY policy.

(repo-wide) · high confidence

Removals

Removal of DoctrineExtensions Migrations component

The entire DoctrineExtensions Migrations subsystem has been removed from the codebase. This includes the core migration classes (AbstractMigration, Migration, Version), configuration loaders (Configuration, XmlConfiguration, YamlConfiguration), and all associated CLI task implementations (DiffTask, ExecuteTask, GenerateTask, MigrateTask, StatusTask, VersionTask). Users can no longer use this library to manage database schema migrations via the command line or programmatic API.

lib/DoctrineExtensions · high confidence

Architecture

Restructure migration versioning logic into a dedicated namespace

The migration versioning logic has been reorganized into the \Doctrine\\Migrations\\Version\ namespace, introducing a cleaner separation of concerns for version management. This change adds an \AliasResolver\ interface and its \DefaultAliasResolver\ implementation to handle version aliases (such as 'first', 'current', 'latest'), and introduces a \Comparator\ interface with an \AlphabeticalComparator\ to standardize version sorting. Core execution components like \DbalExecutor\ and \DbalMigrationFactory\ are now explicitly defined within this namespace, alongside new status calculation classes (\CurrentMigrationStatusCalculator\, \SortedMigrationPlanCalculator\) and supporting value objects (\ExecutionResult\, \State\, \Direction\). This restructuring provides a more modular foundation for calculating migration plans and executing database changes.

src/Version · high confidence

Behavioural changes

Flattened exception class structure in Doctrine Migrations

The exception classes in the \src/Exception\ directory have been reorganized into a flat directory structure, moving all exception files directly under \src/Exception\ rather than nested subdirectories. This change affects the namespace and file paths for all migration-related exceptions (such as \AbortMigration\, \FrozenMigration\, and \UnknownMigrationVersion\), requiring updates to any code that directly references these exception classes by their previous hierarchical paths.

src/Exception · high confidence

Introduce lazy schema loading for DBAL migrations

The DBAL provider now supports lazy loading of the database schema during migration generation. A new \LazySchemaDiffProvider\ wraps the existing schema provider to defer the expensive \introspectSchema()\ call until the schema is actually needed, using native PHP 8.4 lazy objects when available or Symfony's VarExporter for earlier versions. This optimization reduces overhead for migrations that do not require a full schema comparison, while maintaining compatibility with the existing \DBALSchemaDiffProvider\ and \SchemaDiffProvider\ interfaces.

src/Provider · high confidence

Migrations framework rewritten for DBAL 4.3 compatibility

The core migration engine has been rewritten to support DBAL 4.3, introducing a new \AbstractMigration\ base class that enforces a \freeze()\ mechanism to prevent SQL modifications after execution begins. The migration execution flow is now managed by a new \DbalMigrator\ and \EventDispatcher\, which handle transactional execution, dry runs, and event dispatching. Additionally, the \SchemaDumper\ now supports \--nowdoc\ output formatting and improved PCRE error handling, while the \DependencyFactory\ centralizes service wiring with a frozen state to ensure configuration stability.

src · high confidence

New bin/doctrine-migrations entrypoint for Composer-installed usage

A new executable shell script at bin/doctrine-migrations has been added to serve as the primary entry point when the package is installed via Composer. This script delegates to bin/doctrine-migrations.php, which now explicitly searches for the Composer autoloader in standard locations (vendor/autoload.php and ../../../autoload.php) and initializes the ConsoleRunner with a dependency factory. This change allows users to run migrations directly via the bin script without needing the PHP extension in the command, provided the Composer dependencies are installed, while also adding a check to ensure the PHAR build includes dependencies if run in that mode.

bin · high confidence

New migration generator components and nowdoc support

The Generator directory now includes new classes to handle migration generation: ClassNameGenerator for version naming, ConcatenationFileBuilder for SQL file assembly, and updated DiffGenerator and SqlGenerator classes. SqlGenerator now supports a nowdoc output mode (controlled by the nowdocOutput parameter) to format SQL statements using PHP heredoc syntax instead of var\_export, improving readability for long queries. DiffGenerator has been updated to handle schema asset filtering more robustly, including fixes for DBAL 4.3 compatibility and proper handling of table name prefixes during filtering.

src/Generator · high confidence

Refactored migration metadata model and storage layer

The metadata subsystem in src/Metadata has been restructured to use new, dedicated value objects for tracking migration state. Executed and available migrations are now represented by distinct classes (ExecutedMigration, AvailableMigration) and managed via typed lists (ExecutedMigrationsList, AvailableMigrationsList) that support operations like filtering executed versus available sets. The storage layer introduces a MetadataStorage interface and a TableMetadataStorage implementation that persists these states, including execution time and timestamps, while handling schema initialization and updates.

src/Metadata · high confidence

Reorganized CLI commands and added utility formatters

The console command classes have been moved into a new \src/Tools/Console/Command/\ directory structure, and the base \DoctrineCommand\ class now initializes a \ConsoleLogger\ for dependency injection. Two new utility classes, \BooleanStringFormatter\ and \BytesFormatter\, have been added to support configuration parsing and memory usage display. Additionally, the \DiffCommand\ and \DumpSchemaCommand\ now support \--nowdoc\ and \--no-nowdoc\ options to control SQL string formatting.

src/Tools · high confidence

Restructured configuration, event, and query components

The \src/Configuration\, \src/Event\, and \src/Query\ directories have been reorganized to improve modularity. Configuration loading is now handled by a dedicated \Configuration\ class and a suite of loaders (\ConfigurationLoader\, \ConnectionLoader\, \EntityManagerLoader\) that support multiple formats (JSON, PHP, XML, YAML) and sources (files, arrays, existing connections). Event handling has been refactored to use specific argument classes (\MigrationsEventArgs\, \MigrationsVersionEventArgs\) and includes a new \AutoCommitListener\ to manage transaction commits. The \Query\ component now encapsulates SQL statements with their parameters and types, including validation to ensure type counts do not exceed parameter counts.

src/Configuration, src/Event, src/Query · high confidence

Restructured migration finder with dedicated exception types

The migration finder component has been reorganized to improve code clarity and error handling. A new \FinderException\ interface and specific exception classes (\InvalidDirectory\, \NameIsReserved\) have been introduced to provide clearer error messages when loading migrations from invalid directories or encountering reserved names. The core \Finder\ abstract class and its implementations (\GlobFinder\, \RecursiveRegexFinder\) have been refactored to use these new exceptions, ensuring that users receive more descriptive feedback during migration discovery.

src/Finder · high confidence

Test coverage

Added test coverage for Tools and Console commands; Added test stubs for Doctrine Migrations; Added tests for Provider components; Added tests for configuration loading and defaults; Added tests for migration finder implementations; Added tests for multi-namespace migration discovery and query validation; Added unit tests for migration metadata and storage components; Added unit tests for the Generator component; Comprehensive test suite migration and expansion.

Dependencies

Initial release of Doctrine Migrations 3.0 with PHP 8.1+ and modern dependency support

This entry introduces the Doctrine Migrations library (version 3.0) via a new composer.json manifest. It requires PHP 8.1 or higher and Composer runtime API 2, aligning with modern PHP standards. The library depends on Doctrine DBAL 3.6 or 4, Doctrine Event Manager 1.2 or 2, and Symfony Console/Stopwatch/VarExporter 5.4 through 8.0. Development dependencies include PHPUnit 10-12, PHPStan 2, and Doctrine Coding Standard 14, ensuring up-to-date testing and static analysis capabilities. The package is autoloaded via PSR-4 and provides a CLI binary at bin/doctrine-migrations.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 55.

Lenses

  • Code Health 97
  • Architecture 92
  • Maturity 27
  • Readiness 76
  • Security 79

Changes since last survey

  • 300 commits — 269 feature/other, 31 fixes

By area

  • (repo) — 119 commits
  • .github/workflows — 52 commits
  • (root) — 38 commits
  • lib/Doctrine — 27 commits
  • docs/en — 11 commits
  • src/Tools — 8 commits
  • tests/Doctrine — 8 commits
  • tests/Tools — 7 commits
  • src/Generator — 6 commits
  • src/Metadata — 5 commits
  • tests/Configuration — 3 commits
  • tests/Provider — 3 commits
  • .github/dependabot.yml — 2 commits
  • src/AbstractMigration.php — 2 commits
  • src/DbalMigrator.php — 1 commit
  • src/DependencyFactory.php — 1 commit
  • src/Finder — 1 commit
  • src/Provider — 1 commit
  • tests/Finder — 1 commit
  • tests/Helper.php — 1 commit

Notable commits

  • fix: Fix CS
  • fix: Fix PHPStan errors after PHPUnit update (#1350)
  • fix: Fix command options mode (InputOption::VALUE_REQUIRED)
  • fix: Fix formatParameter() for boolean (#1377)
  • fix: Fix formatParameter() for floats (#1374)
  • fix: Fix handling of —nowdoc options
  • fix: Fix removing schema from table name on asset filtering
  • fix: Fix test failing on Windows
  • fix: Fix tests and static analysis (#1274)
  • fix: Fixed all-or-nothing console input value determination.
  • fix: Fixed rendering of migration events list
  • fix: GH-1443: fix --all-or-nothing default behavior
  • fix: Merge pull request #1262 from bendavies/fix-testing-lowest-dependencies
  • fix: Merge pull request #1308 from e-jevdokimovs/fix-all-or-nothing-bug
  • fix: Merge pull request #1330 from gordinskiy/issue-1329-fix-command-deprecations
  • fix: Merge pull request #1340 from greg0ire/fix-build
  • fix: Merge pull request #1423 from greg0ire/fix-cs
  • fix: Merge pull request #1445 from greg0ire/fix-sa
  • fix: Merge pull request #1453 from greg0ire/fix-build
  • fix: Merge pull request #1466 from kfrankiewicz/fix-isAlreadyV3Format-same-versions
  • …and 280 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

doctrine/migrations was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 957641c547ce1584794631ed28b5e365e22905f6 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.