简体   繁体   English

Laravel 迁移查找失败的迁移

[英]Laravel migrations find which migration fails

So when you run php artisan migrate and it fails, it gives you the errors in the terminal.因此,当您运行php artisan migrate并且失败时,它会在终端中显示错误。

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.您可以通过添加标志-vvv来查看完整跟踪,以便识别文件和确切的行。

php artisan migrate -vvv

It will print the same error as laravel.log file它将打印与laravel.log文件相同的错误

If you want to see any errors occurs during debugging, just look into laravel.log file.如果您想查看调试过程中发生的任何错误,只需查看laravel.log文件。

  • Log files are in storage/logs folder.日志文件位于storage/logs文件夹中。 laravel.log is the default filename. laravel.log是默认文件名。 If there is a permission issue with the log folder, Laravel just halts.如果日志文件夹存在权限问题,Laravel 就会停止。 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确保调试模式打开 - 将APP_DEBUG=true添加到.env文件或设置环境变量

Hope this helps you!!希望这对你有帮助!!

You can run php artisan migrate:status to see which migrations have run and which haven't.您可以运行php artisan migrate:status以查看哪些迁移已运行,哪些尚未运行。

The last non-run migration will be the one that has failed.最后一次未运行的迁移将是失败的迁移。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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