Download the PHP package roslov/migration-checker-bundle without Composer
On this page you can find all versions of the php package roslov/migration-checker-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package migration-checker-bundle
Database Migration Checker Bundle
The Database Migration Checker Bundle validates Doctrine Migrations in Symfony by executing each migration up and down against a clean test database and ensuring the schema returns to the exact same state after the rollback. It wraps the core Migration Checker library and provides a ready-to-use Symfony console command.
This is intended for CI pipelines and local checks where you want confidence that every migration can be applied and reverted without leaving stray tables, columns, or indexes behind.
Requirements
- PHP 8.1 or higher,
- Symfony 6.0 or higher,
- Doctrine Migrations Bundle 3.2.1 or higher,
- Doctrine ORM 2.0 or higher.
Supported database types and versions
This bundle supports MySQL, MariaDB, PostgreSQL, and others.
See all supported database types and versions in the Migration Checker documentation.
Limitations
The console command migration-checker:check runs only in the test environment to avoid accidentally affecting the
working database. Therefore, it should always be used with the option --env=test.
Installation
The package could be installed with composer:
If you are not using Symfony Flex, register the bundle manually:
Configuration
If you have a custom Doctrine setup, you can configure the entity manager and the migrations dependency factory.
Create a configuration file config/packages/roslov_migration_checker.yaml:
General usage
What the checker does
For each new Doctrine migration, the checker will:
- Apply the migration (up).
- Roll it back (down).
- Compare the database schema before and after to ensure they match.
- Re-apply the migration to proceed to the next one.
If the schema differs after a rollback, the command fails and prints a unified diff of the schema changes.
Prerequisites
To get useful results, make sure:
- The command is executed in the test environment (
--env=test). - Your test database is empty before the run (fresh schema).
- Doctrine Migrations is configured for the same connection your test environment uses.
Run locally
You can run the command to check your migrations:
Be careful to run it in the test environment, otherwise you can damage your data.
Also, ensure that you run this command on an empty database each time.
Successful output example
Failed output example
Run in CI
The following example spins up a MySQL container, waits for it to be ready, runs the check, and then cleans up. Adjust database credentials and the image name to match your project.
If you want to run it in your CI, you can do something like this:
Testing
Unit testing
The package is tested with PHPUnit. To run tests:
inside a container, or
Code style analysis
The code style is analyzed with PHP_CodeSniffer and PSR-12 Ext coding standard. To run code style analysis:
inside a container, or
from the host machine.
Static analysis
Static analysis is performed with PHPStan. To run it:
inside a container, or
from the host machine.
Full validation
To run all checks (PHP syntax, coding style, PHPStan, and Rector) at once:
All versions of migration-checker-bundle with dependencies
doctrine/doctrine-migrations-bundle Version ^3.2.1|^4.0
doctrine/orm Version ^2.0|^3.0
psr/log Version ^1.0|^2.0|^3.0
roslov/migration-checker Version ^1.0
sebastian/diff Version ^5.0|^6.0|^7.0|^8.0
symfony/config Version ^6.0|^7.0|^8.0
symfony/dependency-injection Version ^6.0|^7.0|^8.0
symfony/framework-bundle Version ^6.0|^7.0|^8.0