Skip to content

Commit aa5ee60

Browse files
fix: disable foreign key constraint when backup
1 parent 0c2dbea commit aa5ee60

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/BackupTablesService.php

+6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ protected function processBackup(array $tablesToBackup = [])
6767

6868
$databaseDriver = DB::connection()->getDriverName();
6969

70+
Schema::disableForeignKeyConstraints();
71+
7072
switch ($databaseDriver) {
7173
case 'sqlite':
7274
$this->backupTablesForSqlite($newTableName, $table);
@@ -83,7 +85,11 @@ protected function processBackup(array $tablesToBackup = [])
8385
break;
8486
default:
8587
throw Exception('NOT SUPPORTED DATABASE DRIVER');
88+
8689
}
90+
91+
Schema::enableForeignKeyConstraints();
92+
8793
}
8894

8995
return [

0 commit comments

Comments
 (0)