High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(mobile): backfill asset dimensions to exif table (#25483)
Brandon Weesc2775894e1a2
diff --git a/mobile/lib/infrastructure/repositories/sync_stream.repository.dart b/mobile/lib/infrastructure/repositories/sync_stream.repository.dartindex c92ce427d5..26f89432a5 100644--- a/mobile/lib/infrastructure/repositories/sync_stream.repository.dart+++ b/mobile/lib/infrastructure/repositories/sync_stream.repository.dart@@ -240,6 +240,8 @@ class SyncStreamRepository extends DriftDatabaseRepository {rating: Value(exif.rating),projectionType: Value(exif.projectionType),lens: Value(exif.lensModel),+ width: Value(exif.exifImageWidth),+ height: Value(exif.exifImageHeight),);batch.insert(diff --git a/mobile/lib/utils/migration.dart b/mobile/lib/utils/migration.dartindex 30a9702b53..56a95c889f 100644--- a/mobile/lib/utils/migration.dart+++ b/mobile/lib/utils/migration.dart@@ -88,6 +88,7 @@ Future<void> migrateDatabaseIfNeeded(Isar db, Drift drift) async {if (version < 20 && Store.isBetaTimelineEnabled) {await _syncLocalAlbumIsIosSharedAlbum(drift);+ await _backfillAssetExifWidthHeight(drift);}if (targetVersion >= 12) {@@ -281,6 +282,22 @@ Future<void> _syncLocalAlbumIsIosSharedAlbum(Drift db) async {}}+Future<void> _backfillAssetExifWidthHeight(Drift db) async {+ try {+ 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;+ ''');++ dPrint(() => "[MIGRATION] Successfully backfilled asset exif width and height");+ } catch (error) {+ dPrint(() => "[MIGRATION] Error while backfilling asset exif width and height: $error");+ }+}+Future<void> migrateDeviceAssetToSqlite(Isar db, Drift drift) async {try {final isarDeviceAssets = await db.deviceAssetEntitys.where().findAll();