2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Integrity constraint violation: 1452... の解決方法

Last updated at Posted at 2020-07-30

エラーメッセージ

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails 

ざっくり理解

外部キーとの関係に矛盾があるときのエラー。

解決方法

リレーションしている(外部キーを設定している)カラムの値が間違っていた(指定した値がリレーション先のテーブルに存在しない)ので、それを修正したら直った。

2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?