Skip to content

Commit

Permalink
[10.x] Add error handling and ensure re-enabling of foreign key const…
Browse files Browse the repository at this point in the history
…raints (#47182)

* Add error handling and ensure re-enabling of foreign key constraints

* Return the result directly from the try block

---------

Co-authored-by: Volodya Khurshudyan <[email protected]>
  • Loading branch information
xurshudyan and Volodya Khurshudyan authored May 23, 2023
1 parent d90054e commit 63ce1c0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Illuminate/Database/Schema/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,11 @@ public function withoutForeignKeyConstraints(Closure $callback)
{
$this->disableForeignKeyConstraints();

$result = $callback();

$this->enableForeignKeyConstraints();

return $result;
try {
return $callback();
} finally {
$this->enableForeignKeyConstraints();
}
}

/**
Expand Down

0 comments on commit 63ce1c0

Please sign in to comment.