unsignedInteger('revision_id')->index(); $table->unsignedInteger('row_id')->index(); $table->foreign('revision_id')->references('id')->on('revisions') ->onDelete('cascade'); // ensure backward integrity constraint (but normally a row should not be deleted unless it's ref is 0) $table->foreign('row_id')->references('id')->on('rows'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('revision_row_pivot'); } }