Skip to content

Commit

Permalink
removes onDeleteSetNull
Browse files Browse the repository at this point in the history
  • Loading branch information
aocneanu committed Mar 7, 2022
1 parent f5ca3ad commit 5084bb0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion config/files.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
'storageLimit' => 500000,
'paginate' => (int) env('FILES_PAGINATION', 50),
'testingFolder' => 'testing',
'onDeleteSetNull' => ['avatars', 'webshop_brands'],
'renameFolders' => [
'dataImport' => 'import',
'dataExport' => 'export',
Expand Down
7 changes: 2 additions & 5 deletions src/Upgrades/DropMorphModels.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,11 @@ private function addForeignKey(string $model): self
{
$table = $this->table($model);
$after = $this->afterColumn($table);
$onDelete = in_array($table, Config::get('enso.files.onDeleteSetNull'))
? 'SET NULL'
: 'restrict';

Schema::table($table, function (Blueprint $table) use ($after, $onDelete) {
Schema::table($table, function (Blueprint $table) use ($after) {
$table->unsignedBigInteger('file_id')->nullable()->after($after);
$table->foreign('file_id')->references('id')->on('files')
->onUpdate('restrict')->onDelete($onDelete);
->onUpdate('restrict')->onDelete('restrict');
});

return $this;
Expand Down

0 comments on commit 5084bb0

Please sign in to comment.