up chunk size

This commit is contained in:
spencerrlongg 2023-09-14 14:25:02 -05:00
parent 7c9a4ac161
commit 44441ec703

View file

@ -21,7 +21,7 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
// Update the eol_explicit column with the value from asset_eol_date if it exists and is different from the calculated value // Update the eol_explicit column with the value from asset_eol_date if it exists and is different from the calculated value
Asset::whereNotNull('asset_eol_date')->chunk(100, function ($assetsWithEolDates) { Asset::whereNotNull('asset_eol_date')->chunk(500, function ($assetsWithEolDates) {
foreach ($assetsWithEolDates as $asset) { foreach ($assetsWithEolDates as $asset) {
if ($asset->asset_eol_date && $asset->purchase_date) { if ($asset->asset_eol_date && $asset->purchase_date) {
$months = CarbonImmutable::parse($asset->asset_eol_date)->diffInMonths($asset->purchase_date); $months = CarbonImmutable::parse($asset->asset_eol_date)->diffInMonths($asset->purchase_date);
@ -37,7 +37,7 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
}); });
// Update the asset_eol_date column with the calculated value if it doesn't exist // Update the asset_eol_date column with the calculated value if it doesn't exist
Asset::whereNull('asset_eol_date')->chunk(100, function ($assets) { Asset::whereNull('asset_eol_date')->chunk(500, function ($assets) {
foreach ($assets as $asset) { foreach ($assets as $asset) {
$model = Asset::find($asset->id)->model; $model = Asset::find($asset->id)->model;
if (!empty($model->eol)) { if (!empty($model->eol)) {