如何绕过/禁用 Laravel 查询上的外键约束
Laminas\Db\Adapter\Exception\InvalidQueryException 无法执行语句(23000 - 1452 - 无法添加或更新子行:外键约束失败(
lms
.student_course_logs
,CONSTRAINTstudent_course_logs_lecture_id_foreign
外键 (lecture_id
) 参考课程
(id
) 删除级联)) http://localhost/public/student/course/loglecture
我的查询中有这个外键约束。我该如何解决这个问题?是否可以绕过外键约束?
这是我的错误日志: https://flareapp.io/share/omwaaZR7#F51
谢谢。
Laminas\Db\Adapter\Exception\InvalidQueryException
Statement could not be executed (23000 - 1452 - Cannot add or update a child row: a foreign key constraint fails (lms
.student_course_logs
, CONSTRAINTstudent_course_logs_lecture_id_foreign
FOREIGN KEY (lecture_id
) REFERENCEScourses
(id
) ON DELETE CASCADE))
http://localhost/public/student/course/loglecture
I'm having this foreign key constraints in my query. How do I solve this one? Would it be possible to bypass foreign key contraints?
Here's my error log: https://flareapp.io/share/omwaaZR7#F51
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论