Debugging Laravel migrations using verbose output

Database Debugging

Committed to the LaraBrain by: wjgilmore (@wjgilmore) at November 12, 2015 3:33 pm

By increasing verbosity you can easily identify a broken migration

A client project I'm currently working on includes almost 50 migrations, and we were recently refactoring some of them in order to cleanup the code a bit. At some point a syntax error was introduced which effectively made it impossible to rerun the migrations, however Laravel only indicated there was an undefined variable named $table with no additional indication of its location:

$ php artisan migrate:refresh

Undefined variable: table

Rather than manually search through the dozens of migrations to find the problem, I simply turned up the debugging verbosity like so:

$ php artisan migrate:refresh -vvv

Undefined variable: table

Exception trace: () at /Users/wjgilmore/Software/