我想在Laravel中創建一個遷移,但它失敗說我有多個主鍵。Laravel遷移失敗多個主鍵
public function up()
{
Schema::create('spins', function (Blueprint $table) {
$table->integer('rid', true, true);
$table->bigInteger('pid');
$table->integer('result');
$table->integer('bet');
$table->timestamps();
$table->primary(array('rid', 'pid'));
});
}
錯誤:
SQLSTATE[42000]: Syntax error or access violation: 1068 Multipleprimary key defined
(SQL: alter table `spins` add primary key `spins_rid_pid_primary` (`rid`, `pid`))
這似乎工作。非常感謝,我可以接受它作爲答案。 – Maantje