简体   繁体   中英

Laravel migrations find which migration fails

So when you run php artisan migrate and it fails, it gives you the errors in the terminal.

Is there a way to see which migration file causes the error? I want to get the filename of that migration.

You can see the full trace by adding the flag -vvv so you can identify the file and the exact line.

php artisan migrate -vvv

It will print the same error as laravel.log file

If you want to see any errors occurs during debugging, just look into laravel.log file.

  • Log files are in storage/logs folder. laravel.log is the default filename. If there is a permission issue with the log folder, Laravel just halts. So if your endpoint generally works - permissions are not an issue.
  • Ensure debug mode is on - either add APP_DEBUG=true to .env file or set an environment variable

Hope this helps you!!

You can run php artisan migrate:status to see which migrations have run and which haven't.

The last non-run migration will be the one that has failed.

要检查错误,您应该查看laravel.log文件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM