当我尝试使用下面的查询从表中删除记录时,我遇到了非常奇怪的问题:
delete from `user_join_groups` where `group_id` = 1 and `user_id` = 217;
下面是Mysql抛出的错误:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'test.user_id' doesn't exist (SQL: delete from `user_join_groups` where `group_id` = 1 and `user_id` = 217)
//"Test" is my database name
我在我的项目中使用Laravel框架,我正在运行上面的查询。下面是生成上面要删除的mysql查询的laravel代码:
\Illuminate\Support\Facades\DB::table('user_join_groups')
->where('group_id', $group_id)
->where('user_id', $this->user->id)->delete();
我还附上了laravel抛出的错误的截图。在截图中,laravel也展示了与迁移相关的东西,但我不确定为什么我会得到这个。
除了Laravel,我还试图从PHPMYADMIN中删除相同的记录,但在这里我得到了相同的错误。
有没有人能告诉我上面的查询出了什么问题,为什么我会得到这个错误?
提前感谢
发布于 2021-02-23 15:49:27
可能您的表不存在,请确保您为表创建了具有正确条目的模型,然后运行"php artisan migrate“。N
https://stackoverflow.com/questions/66328291
复制相似问题