5

Is there a way to show the actual SQL that Laravel-4 will run against a database given a migration?

I would like to see how it will behave before I actually commit it to a database.

Antonio Carlos Ribeiro
  • 86,191
  • 22
  • 213
  • 204
Jason Macgowan
  • 524
  • 7
  • 15

1 Answers1

22

This does the trick:

php artisan migrate --pretend

Jason Macgowan
  • 524
  • 7
  • 15
  • Exceptionally useful for debugging valid PHP that generates invalid SQL. In my case, an the (optional) parameter for a decimal was not being specified $table->decimal(10,2) had a period instead of a comma. – David Hamilton Jun 06 '17 at 03:21