May 17, 2018
Today I have released a new package for your Laravel app. This will generate and show you the SQL for a migration. It works very similarly to
php artisan migrate --pretend but will allow you to view it for any migration, not just pending ones.
I have had a few situations where I've needed to manually migrate a production database as I didn't have access to a command line on the server and it was always a bit of a pain! This package takes most of this pain away.
You can install the package via composer:
composer require josh-taylor/migrate-sql
A new command will then be added to your Laravel project:
php artisan migrate:sql
Supplying no options will display all available migrations and, by default, display the SQL for the up migration. You can specify a migration file and to display the down action.
php artisan migrate:sql --migration=2018_05_17_000000_create_users_table --down
For more options you can pass the
-h flag to see the help text for the command.