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