From a781c78caf5a3283e0de98a4799f16ab3953b399 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 27 Jan 2026 21:48:19 -0600 Subject: [PATCH] fix: width and height migration issue --- mobile/lib/utils/migration.dart | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mobile/lib/utils/migration.dart b/mobile/lib/utils/migration.dart index 56a95c889f..bff6082a35 100644 --- a/mobile/lib/utils/migration.dart +++ b/mobile/lib/utils/migration.dart @@ -284,12 +284,14 @@ Future _syncLocalAlbumIsIosSharedAlbum(Drift db) async { Future _backfillAssetExifWidthHeight(Drift db) async { 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(''' - UPDATE remote_exif_entity AS remote_exif - SET width = asset.width, - height = asset.height - FROM remote_asset_entity AS asset - WHERE remote_exif.asset_id = asset.id; + UPDATE remote_exif_entity + SET width = (SELECT width FROM remote_asset_entity WHERE id = remote_exif_entity.asset_id), + height = (SELECT height FROM remote_asset_entity WHERE id = remote_exif_entity.asset_id) + WHERE (width IS NULL OR width = 0 OR height IS NULL OR height = 0) + AND EXISTS (SELECT 1 FROM remote_asset_entity WHERE id = remote_exif_entity.asset_id); '''); dPrint(() => "[MIGRATION] Successfully backfilled asset exif width and height");