FIX: hopefully fix broken foreign keys management in migrations

This commit is contained in:
Michal Kváček
2016-09-26 16:20:22 +02:00
parent c096a30b81
commit 98fe43e12c
2 changed files with 37 additions and 1 deletions
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RenameForeignKeyInWidgets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('widgets', function (Blueprint $table) {
$table->dropForeign('fk_widget_user1');
$table->foreign('user_id')
->references('id')
->on('users')
->onDelete('no action')
->onUpdate('no action');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// do nothing
}
}