An artisan command to check for pending migrations. Exits with non-zero code if there any. Useful for detection whether to run migrations when using automatical deployment
Laravel has a migrate:status command to check status of migrations. But this command mostly for humans. But there are situations where one needs to know whether to run migrations when autodeploying to production environment, maybe with switching to maintenance mode.
This package contains a migrate:check command that exits with non-zero code if there are any migrations to run.
This command supports all database drivers that Laravel does.
You can install the package via composer:
composer require erjanmx/laravel-migrate-checkNext add the Erjanmx\MigrateCheck\Commands\MigrateCheckCommand class to your console kernel.
// app/Console/Kernel.php
protected $commands = [
...
\Erjanmx\MigrateCheck\Commands\MigrateCheckCommand::class,
]php artisan migrate:сheckYou can specify database and path to migration file via options just like they are used in php artisan migrate command
Please see CHANGELOG for more information what has changed recently.
In order for the test to be run you should set up an empty mysql database laravel_migrate_check . The username should be root, the required password should be empty.
$ composer testPlease see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.