お世話になっております。
表題の通り、Laravel5のEloquentでDBを設定し、外部キーを設定しようとしております。
ソースは下記のとおりなのですがエラーが出ます。
対処方法が分かる方いらっしゃいましたらよろしくお願いします。
create_events_table.php
1class CreateEventsTable extends Migration 2{ 3 public function up() 4 { 5 Schema::create('events', function (Blueprint $table) { 6 $table->bigIncrements('id'); 7 $table->string('event_name'); 8 $table->timestamps(); 9 $table->softDeletes(); 10 }); 11 } 12}
create_event_tickets_table.php
1class CreateDownloadTicketsTable extends Migration 2{ 3 /** 4 * Run the migrations. 5 * 6 * @return void 7 */ 8 public function up() 9 { 10 Schema::create('download_tickets', function (Blueprint $table) { 11 $table->bigIncrements('id'); 12 $table->bigInteger('event_id') 13 ->unsigned(); 14 $table->foreign('event_id') 15 ->references('id') 16 ->on('events') 17 ->onDelete('SET NULL') 18 ->onUpdate('SET NULL'); 19 $table->bigInteger('ticket_id') 20 ->comment('チケットID'); 21 $table->timestamps(); 22 $table->softDeletes(); 23 }); 24 } 25}
error_message
あなたの回答
tips
プレビュー