You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
930 B
34 lines
930 B
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class AddForeignKeysToBeerGrainsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::table('beer_grains', function (Blueprint $table) {
|
|
$table->foreign('beer_id', 'beer_id')->references('beer_id')->on('beer_summary')->onUpdate('RESTRICT')->onDelete('RESTRICT');
|
|
$table->foreign('grain_id', 'grain_id')->references('id')->on('grains')->onUpdate('RESTRICT')->onDelete('RESTRICT');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::table('beer_grains', function (Blueprint $table) {
|
|
$table->dropForeign('beer_id');
|
|
$table->dropForeign('grain_id');
|
|
});
|
|
}
|
|
}
|