mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix: width and height migration issue
This commit is contained in:
@@ -284,12 +284,14 @@ Future<void> _syncLocalAlbumIsIosSharedAlbum(Drift db) async {
|
|||||||
|
|
||||||
Future<void> _backfillAssetExifWidthHeight(Drift db) async {
|
Future<void> _backfillAssetExifWidthHeight(Drift db) async {
|
||||||
try {
|
try {
|
||||||
|
// Only backfill width/height when exif values are NULL or 0
|
||||||
|
// Don't overwrite existing valid exif dimensions (especially important for videos)
|
||||||
await db.customStatement('''
|
await db.customStatement('''
|
||||||
UPDATE remote_exif_entity AS remote_exif
|
UPDATE remote_exif_entity
|
||||||
SET width = asset.width,
|
SET width = (SELECT width FROM remote_asset_entity WHERE id = remote_exif_entity.asset_id),
|
||||||
height = asset.height
|
height = (SELECT height FROM remote_asset_entity WHERE id = remote_exif_entity.asset_id)
|
||||||
FROM remote_asset_entity AS asset
|
WHERE (width IS NULL OR width = 0 OR height IS NULL OR height = 0)
|
||||||
WHERE remote_exif.asset_id = asset.id;
|
AND EXISTS (SELECT 1 FROM remote_asset_entity WHERE id = remote_exif_entity.asset_id);
|
||||||
''');
|
''');
|
||||||
|
|
||||||
dPrint(() => "[MIGRATION] Successfully backfilled asset exif width and height");
|
dPrint(() => "[MIGRATION] Successfully backfilled asset exif width and height");
|
||||||
|
|||||||
Reference in New Issue
Block a user