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 1 year has passed since last update.

Syntax error or access violation: 1068 Multiple primary key defined っていわれても主キーを1つしか設定してないよ…

0
Posted at

それはmigrateをするときでした。

SQLSTATE[42000]: Syntax error or access violation: 1068 Multiple primary key defined

すでに主キーが設定されてるから二重登録はできんよ〜ということですね。

migrateファイルを確認しても主キーの設定は一つしかしてないし、他のmigrateファイルの影響でもなさそうだし…も〜わけがわからん!と1時間ぐらいうなってました…

原因はしょうもないことです…

smallInt('hoge') に桁数の指定がしてあったんですね…

smallInt('hoge', 8) こんな感じで…

桁数の指定はできないよね〜。

指定するとなぜがAUTO_INCREMENTになってPRIMARY_KEYになってしまってたみたい。

なので上記のエラーが吐き出されたというわけでした…

こういうこともあるんですね〜…

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?