Skip to content

NOW MANAGED ON CODEBERG

Added a little protection to migration query

Dan Brownd0dc5e5c5dac
diff --git a/database/migrations/2022_09_02_082910_fix_shelf_cover_image_types.php b/database/migrations/2022_09_02_082910_fix_shelf_cover_image_types.php
index 837bdfe24..a9a413607 100644
--- a/database/migrations/2022_09_02_082910_fix_shelf_cover_image_types.php
+++ b/database/migrations/2022_09_02_082910_fix_shelf_cover_image_types.php
@@ -22,10 +22,12 @@ class FixShelfCoverImageTypes extends Migration
->pluck('image_id')
->values()->all();
- DB::table('images')
- ->where('type', '=', 'cover_book')
- ->whereIn('id', $shelfImageIds)
- ->update(['type' => 'cover_bookshelf']);
+ if (count($shelfImageIds) > 0) {
+ DB::table('images')
+ ->where('type', '=', 'cover_book')
+ ->whereIn('id', $shelfImageIds)
+ ->update(['type' => 'cover_bookshelf']);
+ }
}
/**