fix(command): enhance cleanup process for stuck application previews by adding force delete for trashed records
This commit is contained in:
@@ -82,12 +82,21 @@ class CleanupStuckedResources extends Command
|
|||||||
foreach ($applicationsPreviews as $applicationPreview) {
|
foreach ($applicationsPreviews as $applicationPreview) {
|
||||||
if (! data_get($applicationPreview, 'application')) {
|
if (! data_get($applicationPreview, 'application')) {
|
||||||
echo "Deleting stuck application preview: {$applicationPreview->uuid}\n";
|
echo "Deleting stuck application preview: {$applicationPreview->uuid}\n";
|
||||||
$applicationPreview->delete();
|
$applicationPreview->forceDelete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
echo "Error in cleaning stuck application: {$e->getMessage()}\n";
|
echo "Error in cleaning stuck application: {$e->getMessage()}\n";
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
$applicationsPreviews = ApplicationPreview::withTrashed()->whereNotNull('deleted_at')->get();
|
||||||
|
foreach ($applicationsPreviews as $applicationPreview) {
|
||||||
|
echo "Deleting stuck application preview: {$applicationPreview->uuid}\n";
|
||||||
|
$applicationPreview->forceDelete();
|
||||||
|
}
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
echo "Error in cleaning stuck application: {$e->getMessage()}\n";
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
$postgresqls = StandalonePostgresql::withTrashed()->whereNotNull('deleted_at')->get();
|
$postgresqls = StandalonePostgresql::withTrashed()->whereNotNull('deleted_at')->get();
|
||||||
foreach ($postgresqls as $postgresql) {
|
foreach ($postgresqls as $postgresql) {
|
||||||
|
Reference in New Issue
Block a user