mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
refactor
This commit is contained in:
parent
46af40bd02
commit
8c9961aba8
|
@ -55,8 +55,15 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
Asset::whereNull('asset_eol_date')->whereNotNull('purchase_date')->has('model')
|
// 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)')]);
|
// ->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)')
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue