fix migration
This commit is contained in:
parent
c04d8e37bb
commit
01b3659a36
1 changed files with 4 additions and 0 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue