-1

After creating multiple migrations I started editing these and sometimes testing them out. All was working well untill I tried the use of foreign keys taken from this example.

For some reason this wasn't working for me, so I decided to remove everything with foreign. Now when I run a php artisan migrate I get the following error:

[Symfony\Component\Debug\Exception\FatalErrorException] syntax error, unexpected ';'

I know it's related to one of the migrations I edited, but how can I quickly find it without going through all the migrations I created.

My question isn't about where my problem is (so my exact code isn't necessary), but how to debug efficiently?

EDIT:

I just tried php artisan:rollback and that works.

EDIT #2:

I just 'fixed' my problem, but would like to know for future reference how to debug faster.

davejal
  • 6,009
  • 10
  • 39
  • 82

1 Answers1

3

Run the artisan command with verbose output

php artisan -vvv migrate

This will reveal more information about the syntax error.

Edit: from my comment,

You can quickly scan for syntax issues with the following cli command (unix only)

find -L database/migrations -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l

For users on windows using git bash:

find database/migrations -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
davejal
  • 6,009
  • 10
  • 39
  • 82
Ben Rowe
  • 28,406
  • 6
  • 55
  • 75