0
0

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.

シーダー実行に失敗したためSQLSTATE[42S22]:のエラーが発生

Posted at

##環境
Laravel6(PHP7.3以上)
MySQL8.0
Laradock(Docker)
Vscode

##エラー発生
seederでテストデータを挿入する際に、下記のエラーが出ました。

SQLSTATE[42S22]:
PDOException::("SQLSTATE[42S22]: Column not found: 1054 Unknown column 'prduct_name' in 'field list'")

##エラーの内容
「エラー文の表示からわかるように、フィールド(テーブル)に'prduct_name'というカラムがないですよ。」
と優しく教えてくれています。

テーブルにエラー文で表示されたカラムがあるか確認し、Insert文でそのカラムが正しく書けているかを確認してください。

##解決方法
自分はInsert文で指定したカラムのスペルがテーブルにあるカラムと違っていたためSQLSTATE[42S22]:が発生しました。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?