migrationでテーブルを作成しようとすると、other_idはbiginterなのにprimaryなどが付いてしまい、作成できません。。。。
ご助力いただけないでしょうか?
php
1<?php 2 3use Illuminate\Database\Schema\Blueprint; 4use Illuminate\Database\Migrations\Migration; 5 6class CreateUsersTable extends Migration 7{ 8 /** 9 * Run the migrations. 10 * 11 * @return void 12 */ 13 public function up() 14 { 15 Schema::create('users', function (Blueprint $table) { 16 $table->bigIncrements('user_id', 20); 17 $table->bigInteger('other_id', 20); 18 $table->timestamps(); 19 }); 20 } 21 22 /** 23 * Reverse the migrations. 24 * 25 * @return void 26 */ 27 public function down() 28 { 29 Schema::drop('users'); 30 } 31} 32
エラー内容
[Illuminate\Database\QueryException]SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key(SQL: create table users
(user_id
bigint unsigned not null auto_increment primary key, other_id
bigint not null auto_increment primary key, created_at
timestamp not null, updated_at
timestamp not null) default chara set utf8 collate utf8_unicode_ci) ```
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/02/10 06:13
2016/02/10 06:14