Merge pull request #14097 from spencerrlongg/hotfix/migration_model_issue

Use Query Builder instead of Model for Update to Skip Observer
This commit is contained in:
snipe 2024-01-04 00:36:30 +00:00 committed by GitHub
commit 0c6611d6bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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]);
}
}
}