From 419710402657ceb0c4c870dae8a708f1c8b60ba2 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 21 Jan 2025 14:02:29 +0100 Subject: [PATCH] fix(db): `finished_at` timestamps are not set for existing deployments --- ...date_finished_at_timestamps_if_not_set.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 database/migrations/2025_01_21_125205_update_finished_at_timestamps_if_not_set.php diff --git a/database/migrations/2025_01_21_125205_update_finished_at_timestamps_if_not_set.php b/database/migrations/2025_01_21_125205_update_finished_at_timestamps_if_not_set.php new file mode 100644 index 000000000..050e8f1ae --- /dev/null +++ b/database/migrations/2025_01_21_125205_update_finished_at_timestamps_if_not_set.php @@ -0,0 +1,37 @@ +whereNull('finished_at') + ->update(['finished_at' => DB::raw('updated_at')]); + } catch (\Exception $e) { + \Log::error('Failed to update not set finished_at timestamps for application_deployment_queues: '.$e->getMessage()); + } + + try { + DB::table('scheduled_database_backup_executions') + ->whereNull('finished_at') + ->update(['finished_at' => DB::raw('updated_at')]); + } catch (\Exception $e) { + \Log::error('Failed to update not set finished_at timestamps for scheduled_database_backup_executions: '.$e->getMessage()); + } + + try { + DB::table('scheduled_task_executions') + ->whereNull('finished_at') + ->update(['finished_at' => DB::raw('updated_at')]); + } catch (\Exception $e) { + \Log::error('Failed to update not set finished_at timestamps for scheduled_task_executions: '.$e->getMessage()); + } + } +};