gpt4 book ai didi

php artisan - 任何命令上的未知表错误

转载 作者:行者123 更新时间:2023-11-29 12:03:47 28 4
gpt4 key购买 nike

由于某种原因,每当我运行任何 php artisan 命令时,我都会收到一条错误消息,指出我的一个表不存在。这是真的,我正在开始一个新的数据库。我不明白的是, artisan 到底为什么需要使用这张 table ?显示的错误是:

[Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table
'happylister.categories' doesn't exist (SQL: select *
from `categories` order by `name` asc)

[PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table
'happylister.categories' doesn't exist

我就是无法弄清楚该查询来自哪里 - 即使仅使用 php artisan 也会生成此错误。当我尝试运行 php artisan migrate 来设置表时,我第一次注意到这一点,当然失败了。然后我注意到所有 php artisan 命令都失败了。

所以我的问题是:为什么 php artisan 需要一个特定于我的应用程序的表,因为通常您应该能够在干净的数据库上使用 php artisan设置一下?

最佳答案

一位 Laracasts 用户非常友善地帮助我回答了这个问题:

If you're referencing a model from a service provider and the migrations have not been run, then you'll get that error. For some reason Artisan commands like to load all the providers, even ones it doesn't need.

感谢 Laracasts 论坛上的 FetchTheDev。

关于php artisan - 任何命令上的未知表错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31917778/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com