mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
cleanup
This commit is contained in:
parent
cc82e86eeb
commit
c07c0c0f74
|
@ -42,21 +42,6 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
|
|||
}
|
||||
});
|
||||
|
||||
// Update the asset_eol_date column with the calculated value if it doesn't exist
|
||||
// Asset::whereNull('asset_eol_date')->with('model')->chunkById(500, function ($assets) {
|
||||
// foreach ($assets as $asset) {
|
||||
// if ($asset->model->eol && $asset->purchase_date) {
|
||||
// try {
|
||||
// $asset_eol_date = CarbonImmutable::parse($asset->purchase_date)->addMonths($asset->model->eol)->format('Y-m-d');
|
||||
// $asset->update(['asset_eol_date' => $asset_eol_date]);
|
||||
// } catch (\Exception $e) {
|
||||
// Log::info('purchase date invalid for asset ' . $asset->id);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// 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')
|
||||
|
|
Loading…
Reference in a new issue