Download the PHP package mll-lab/laravel-conditional-migrations without Composer
On this page you can find all versions of the php package mll-lab/laravel-conditional-migrations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mll-lab/laravel-conditional-migrations
More information about mll-lab/laravel-conditional-migrations
Files in mll-lab/laravel-conditional-migrations
Package laravel-conditional-migrations
Short Description Run your Laravel migrations only when you want them to
License MIT
Informations about the package laravel-conditional-migrations
Laravel Conditional Migrations
Deprecated
This package is deprecated in favor of https://github.com/mll-lab/laravel-utils/releases/tag/v4.0.0 and will no longer be updated.
Run migrations only if a condition is true
Based on https://github.com/onlinepets/laravel-conditional-migrations
Installation
Via composer:
composer require mll-lab/laravel-conditional-migrations
Usage
To run a migration conditionally, implement the ConditionalMigration
interface and its ->shouldRun()
method:
The code snippet above will make sure the do_something_very_intensive
migration
will be skipped unless it is executed between 1 AM and 2 AM. This can be useful
if your migration does something that should not be run during the daytime, like
adding an index to a table containing lots of data.
Configuration
You can optionally publish the configuration file:
php artisan vendor:publish --tags=conditional-migrations-config
This will create the file config/conditional-migrations.php
.
The always_run
option allows you to overrule the conditions set in individual migrations.
You can also use a closure if you want to do more advanced calculations:
Changelog
All notable changes to this project are documented in CHANGELOG.md
.
Contributing
Contributions are welcome, see CONTRIBUTING.md.
License
See LICENSE.md.