ADD disable foreign key for cleanup command
This commit is contained in:
parent
de1eb871b9
commit
ab76515822
@ -115,6 +115,9 @@ public function handle(): int
|
||||
|
||||
$this->info('Törlés megkezdése...');
|
||||
|
||||
\Illuminate\Support\Facades\Schema::disableForeignKeyConstraints();
|
||||
|
||||
try {
|
||||
// Orders törlése
|
||||
Order::where('deliveryDate', '<', $date)->delete();
|
||||
$this->info('Megrendelések törölve.');
|
||||
@ -156,6 +159,9 @@ public function handle(): int
|
||||
$bar->finish();
|
||||
$this->info("");
|
||||
$this->info('Archivált megrendelések és kapcsolódó elemek törölve.');
|
||||
} finally {
|
||||
\Illuminate\Support\Facades\Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ public function handle(): int
|
||||
}
|
||||
|
||||
$this->info('Törlés megkezdése...');
|
||||
|
||||
\Illuminate\Support\Facades\Schema::disableForeignKeyConstraints();
|
||||
// PriceLists törlése optimalizáltan
|
||||
if ($priceListsCount > 0) {
|
||||
$this->info('Árlisták és kapcsolódó árak törlése...');
|
||||
@ -151,7 +151,7 @@ public function handle(): int
|
||||
}
|
||||
|
||||
$this->info('A tisztítás sikeresen befejeződött.');
|
||||
|
||||
\Illuminate\Support\Facades\Schema::enableForeignKeyConstraints();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user