From 0d853f931d673b875eb773395843ba5445e3d09c Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Wed, 3 Jan 2024 18:32:13 -0600 Subject: [PATCH] use query builder instead of model for update to skip observer --- ...zed_eol_and_add_column_for_explicit_date_to_assets.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/database/migrations/2023_07_13_052204_denormalized_eol_and_add_column_for_explicit_date_to_assets.php b/database/migrations/2023_07_13_052204_denormalized_eol_and_add_column_for_explicit_date_to_assets.php index f9c7b3d811..146e5b2d71 100644 --- a/database/migrations/2023_07_13_052204_denormalized_eol_and_add_column_for_explicit_date_to_assets.php +++ b/database/migrations/2023_07_13_052204_denormalized_eol_and_add_column_for_explicit_date_to_assets.php @@ -36,10 +36,12 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration } if ($asset->model->eol) { if ($months != $asset->model->eol) { - $asset->update(['eol_explicit' => true]); + DB::table('assets')->where('id', $asset->id)->update(['eol_explicit' => true]); } - } else { - $asset->update(['eol_explicit' => true]); + } + // if there is NO model eol, but there is a purchase date and an asset_eol_date (which is what is left over) the asset_eol_date has still been explicitly set + else { + DB::table('assets')->where('id', $asset->id)->update(['eol_explicit' => true]); } } }