<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddForeignsToQuartiersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('quartiers', function (Blueprint $table) {
$table
->foreign('commune_id')
->references('id')
->on('communes')
->onUpdate('CASCADE')
->onDelete('CASCADE');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('quartiers', function (Blueprint $table) {
$table->dropForeign(['commune_id']);
});
}
}