Laravel Patches Documentation

🎉 Enjoying this package? Consider sponsoring me on GitHub or buying me a beer.


Making Patches

1php artisan make:patch patch_1_0_0

This created a timestamped patch file under database/patches.

Running Patches

To run all available patches:

1php artisan patch

To run each available patch in its own batch:

1php artisan patch --step

To force the patches to run in production (deploy scripts, etc.):

1php artisan patch --force

Rolling Back Patches

To rollback all patches of the last batch:

1php artisan patch:rollback

To rollback the last X patches regardless of batch:

1php artisan patch:rollback --step=X

Patch File Helpers

You may use the following helper commands from your patch files:

Log a line to the patches log column (up method only):

1$this->log('10 users modified');

Call an Artisan command with options:

1$this->call($command, $parameters);

Call a seeder by class name:


Truncate a table by name:


Note: Does not disable foreign key checks.