increments('id'); $table->unsignedInteger('member_id'); $table->integer('year'); $table->integer('real_number_last_year')->nullable(); $table->integer('estimated_number_next_year')->nullable(); $table->unique(['member_id', 'year']); $table->timestamps(); }); Schema::table('summaries', function (Blueprint $table) { $table->foreign('member_id')->references('id')->on('members')->onDelete('cascade'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('summaries', function (Blueprint $table) { $table->dropForeign('summaries_member_id_foreign'); }); Schema::dropIfExists('summaries'); } }