Added a little protection to migration query

Just to be sure the query is filtered as expected to only affect
shelf-based images.
This commit is contained in:
Dan Brown 2022-09-08 12:26:14 +01:00
parent e4642257a6
commit d0dc5e5c5d
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9

View File

@ -22,10 +22,12 @@ class FixShelfCoverImageTypes extends Migration
->pluck('image_id') ->pluck('image_id')
->values()->all(); ->values()->all();
DB::table('images') if (count($shelfImageIds) > 0) {
->where('type', '=', 'cover_book') DB::table('images')
->whereIn('id', $shelfImageIds) ->where('type', '=', 'cover_book')
->update(['type' => 'cover_bookshelf']); ->whereIn('id', $shelfImageIds)
->update(['type' => 'cover_bookshelf']);
}
} }
/** /**