Added comments

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-10-13 12:34:46 +01:00
parent b2aed7feea
commit 2537d0fdaf
2 changed files with 4 additions and 1 deletions

View file

@ -129,7 +129,8 @@ class AssetObserver
*
* For example, if there is a database migration that's a bit older and modifies an asset, if the save
* fires before a field gets created in a later migration and that field in the later migration
* is used in this observer, it doesn't actually exist yet and the migration will break.
* is used in this observer, it doesn't actually exist yet and the migration will break unless we
* use saveQuietly() in the migration which skips this observer.
*
* @see https://github.com/snipe/snipe-it/issues/13723#issuecomment-1761315938
*/

View file

@ -23,6 +23,8 @@ class AddEolDateOnAssetsTable extends Migration
});
// Chunk the model query to get the models that do have an EOL date
// We use saveQuietly() here to skip the AssetObserver, since it modifies fields
// that do not yet exist on the assets table.
AssetModel::whereNotNull('eol')->chunk(10, function ($models) {
foreach ($models as $model) {
foreach ($model->assets as $asset) {