[英]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
文件。
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.因此,如果您的端点通常有效 - 权限不是问题。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.