Download the PHP package roslov/laravel-migration-checker without Composer
On this page you can find all versions of the php package roslov/laravel-migration-checker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-migration-checker
Database Migration Checker For Laravel
This package validates Laravel database migrations by ensuring every pending migration can be applied and rolled back without leaving schema differences. It is a Laravel wrapper around Migration Checker and integrates directly with Artisan, so you can use it as part of your local workflow or CI.
The checker runs migrations one by one:
- Creates the migrations table if needed.
- Takes a schema snapshot.
- Applies the next pending migration.
- Rolls the migration back.
- Compares the schema dump to the original state.
If the schema differs, the command fails and prints a diff so you can pinpoint what was left behind.
Requirements
- PHP 8.1 or higher,
- Laravel 10.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=testing.
The command checks only pending migrations and executes them one at a time. It uses the migration paths in
database/migrations and database/settings by default.
Installation
The package can be installed with Composer:
General usage
1. Ensure a clean test database
Run the checker against a disposable database. It must be empty, so the schema snapshot reflects only what your migrations create.
2. Run the checker
You can run the command to check your migrations in the test environment:
By default, the command searches for migrations in such folders:
database/migrationsdatabase/settings
But you can add extra paths. For example, if there are some vendors that add their migrations.
Use --extra-path for this:
Be careful to run it in the test environment, otherwise you can damage your data.
You can target a specific connection if you have multiple databases configured:
3. Review output
The output example of the successful run:
The output example of the failed run:
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
from the host machine.
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.
All validations
To run all validations at once (syntax check, code style, static analysis, and Rector):
All versions of laravel-migration-checker with dependencies
illuminate/console Version ^10.0|^11.0|^12.0|^13.0
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
roslov/migration-checker Version ^1.0
sebastian/diff Version ^5.0|^6.0|^7.0|^8.0