This commit is contained in:
spencerrlongg 2023-10-04 15:40:42 -05:00
parent 46af40bd02
commit 8c9961aba8

View file

@ -55,8 +55,15 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
// }
// }
// });
Asset::whereNull('asset_eol_date')->whereNotNull('purchase_date')->has('model')
->update(['asset_eol_date' => DB::raw('LEFT JOIN models ON assets.model_id = models.id) DATE_ADD(purchase_date, INTERVAL models.eol MONTH)')]);
// Asset::whereNull('asset_eol_date')->whereNotNull('purchase_date')->has('model')
// ->update(['asset_eol_date' => DB::raw('LEFT JOIN models ON assets.model_id = models.id) DATE_ADD(purchase_date, INTERVAL models.eol MONTH)')]);
DB::table('assets')
->whereNull('asset_eol_date')
->whereNotNull('purchase_date')
->join('models', 'assets.model_id', '=', 'models.id')
->update([
'asset_eol_date' => DB::raw('DATE_ADD(purchase_date, INTERVAL models.eol MONTH)')
]);
}