Laravelで移行を作成しています。コマンドを実行するとphp artisan migrate
、次のエラーが表示されます。
重複する列名 'user_id' ('id' int unsigned not null auto_increment 主キー、'user_id' int unsigned not null、'user_id' int not null、'order_id_' int unsigned not null、'order_id' int not null) デフォルト文字utf8 照合 utf8_unicode_ci を設定)
これは私の移行です:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUserOrrderTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_orrder', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->integer('user_id')->references('id')->on('users');
$table->integer('order_id')->unsigned();
$table->integer('order_id')->references('id')->on('orders');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_orrder');
}
}