From b2c93897ed381deccf01d350b8d151414d0b24ae Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 27 Nov 2016 17:19:31 +0200 Subject: [PATCH] Fix for database migration --- .../migrations/2016_09_05_150625_create_gateway_types.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/database/migrations/2016_09_05_150625_create_gateway_types.php b/database/migrations/2016_09_05_150625_create_gateway_types.php index 8010fb91659b..518639da9ad0 100644 --- a/database/migrations/2016_09_05_150625_create_gateway_types.php +++ b/database/migrations/2016_09_05_150625_create_gateway_types.php @@ -46,11 +46,15 @@ class CreateGatewayTypes extends Migration $table->unsignedInteger('gateway_type_id')->nullable(); }); + // http://laravel.io/forum/09-18-2014-foreign-key-not-saving-in-migration + DB::statement('SET FOREIGN_KEY_CHECKS=0;'); Schema::table('payment_types', function($table) { $table->foreign('gateway_type_id')->references('id')->on('gateway_types')->onDelete('cascade'); }); + DB::statement('SET FOREIGN_KEY_CHECKS=1;'); } + /** * Reverse the migrations. *