0
我想打表迁移, 但是当我执行有错误按摩用户ID成为主键和自动增量由它的自我
Incorrect table definition; there can be only one auto column and it must be defined as key
,但我没有设置用户ID为增量和主键,为什么?
我是一个初学者反正 这里是我的代码
Schema::create('orders', function(Blueprint $table){
$table->increments('order_id');
$table->dateTime('order_date');
$table->integer('order_status')->default(0);
$table->integer('user_id', 10)->unsigned();
$table->string('npk_user_approval', 10);
$table->string('npk_ga_approval', 10);
$table->dateTime('approval_user_at')->nullable();
$table->dateTime('approval_ga_at')->nullable();
$table->dateTime('reject_user_at')->nullable();
$table->dateTime('reject_ga_at')->nullable();
$table->dateTime('created_at')->nullable();
$table->string('created_by', 50)->nullable();
$table->dateTime('updated_at')->nullable();
$table->string('updated_by', 50)->nullable();
$table->foreign('user_id')->references('id')->on('users');
});
您使用的是哪个版本的Laravel? – Gadzhev
@Gadzhev我使用的是5.3版本 –