As an alternative solution that does not require the installation of event listeners, you can use the --pretend option when running the command:
php artisan migrate --pretend
This will unload the SQL queries that will be executed during the migration, but without actually performing the migration. It will print on each line the name of the migration class and query executed from this migration, so for the migration that creates the users table with a unique email column, you will get something like this:
CreateUsersTable: create table `users` (`id` int unsigned not null auto_increment primary key, `email` varchar(255) not null, `password` varchar(60) not null, `created_at` timestamp default 0 not null, `updated_at` timestamp default 0 not null) default character set utf8 collate utf8_unicode_ci CreateUsersTable: alter table `users` add unique users_email_unique(`email`)
This option is present since Laravel 4 up to the latest version of Laravel (which at the time when I send this answer is 5.1).
Bogdan
source share