diff --git a/database/migrations/2021_03_04_210637_change_foreign_keys_to_cascade_on_customer_delete.php b/database/migrations/2021_03_04_210637_change_foreign_keys_to_cascade_on_customer_delete.php index a6b3e3c..c8da5d9 100644 --- a/database/migrations/2021_03_04_210637_change_foreign_keys_to_cascade_on_customer_delete.php +++ b/database/migrations/2021_03_04_210637_change_foreign_keys_to_cascade_on_customer_delete.php @@ -14,6 +14,7 @@ class ChangeForeignKeysToCascadeOnCustomerDelete extends Migration */ public function up() { + Schema::disableForeignKeyConstraints(); Schema::table('customer_infos', function (Blueprint $table) { $table->dropForeign(['customer_id']); $table->foreign('customer_id')->references('id') @@ -30,6 +31,7 @@ class ChangeForeignKeysToCascadeOnCustomerDelete extends Migration $table->foreign('brand_id')->references('id') ->on('brands')->onDelete('cascade'); }); + Schema::enableForeignKeyConstraints(); } /** @@ -39,6 +41,7 @@ class ChangeForeignKeysToCascadeOnCustomerDelete extends Migration */ public function down() { + Schema::disableForeignKeyConstraints(); Schema::table('customer_infos', function (Blueprint $table) { $table->dropForeign(['customer_id']); $table->foreign('customer_id')->references('id') @@ -55,5 +58,6 @@ class ChangeForeignKeysToCascadeOnCustomerDelete extends Migration $table->foreign('brand_id', 'customer_login_brand_id_foreign')->references('id') ->on('brands')->onUpdate('restrict')->onDelete('restrict'); }); + Schema::enableForeignKeyConstraints(); } }