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:
parent
e4642257a6
commit
d0dc5e5c5d
|
@ -22,11 +22,13 @@ class FixShelfCoverImageTypes extends Migration
|
||||||
->pluck('image_id')
|
->pluck('image_id')
|
||||||
->values()->all();
|
->values()->all();
|
||||||
|
|
||||||
|
if (count($shelfImageIds) > 0) {
|
||||||
DB::table('images')
|
DB::table('images')
|
||||||
->where('type', '=', 'cover_book')
|
->where('type', '=', 'cover_book')
|
||||||
->whereIn('id', $shelfImageIds)
|
->whereIn('id', $shelfImageIds)
|
||||||
->update(['type' => 'cover_bookshelf']);
|
->update(['type' => 'cover_bookshelf']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
|
|
Loading…
Reference in New Issue