]>
BookStack Code Mirror - bookstack/commitdiff
projects
/
bookstack
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
| inline |
side by side
(parent:
e464225
)
Added a little protection to migration query
author
Dan Brown
<redacted>
Thu, 8 Sep 2022 11:26:14 +0000
(12:26 +0100)
committer
Dan Brown
<redacted>
Thu, 8 Sep 2022 11:26:14 +0000
(12:26 +0100)
Just to be sure the query is filtered as expected to only affect
shelf-based images.
database/migrations/2022_09_02_082910_fix_shelf_cover_image_types.php
patch
|
blob
|
history
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 837bdfe244ddcc6f907f9b3224cd6c2e95f266b3..a9a413607da8b050b0d0eea7a5bba021b293792b 100644
(file)
--- 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']);
+ }
}
/**