Browse Source

add migration and update gitignore to ignore isar

Luke McCarthy 2 years ago
parent
commit
49fae9c4cc
3 changed files with 7 additions and 2 deletions
  1. 3 1
      mobile/.gitignore
  2. 2 1
      mobile/lib/shared/models/asset.dart
  3. 2 0
      mobile/lib/utils/migration.dart

+ 3 - 1
mobile/.gitignore

@@ -53,4 +53,6 @@ ios/fastlane/report.xml
 # Isar
 default.isar
 default.isar.lock
-libisar.so
+libisar.so
+default.isar-lck 
+isar.dll

+ 2 - 1
mobile/lib/shared/models/asset.dart

@@ -228,7 +228,6 @@ class Asset {
   bool canUpdate(Asset a) {
     assert(isInDb);
     assert(checksum == a.checksum);
-    assert(thumbhash == a.thumbhash);
     assert(a.storage != AssetState.merged);
     return a.updatedAt.isAfter(updatedAt) ||
         a.isRemote && !isRemote ||
@@ -268,6 +267,7 @@ class Asset {
           livePhotoVideoId: livePhotoVideoId,
           isFavorite: isFavorite,
           isArchived: isArchived,
+          thumbhash: thumbhash,
         );
       }
     } else {
@@ -282,6 +282,7 @@ class Asset {
           // isFavorite + isArchived are not set by device-only assets
           isFavorite: a.isFavorite,
           isArchived: a.isArchived,
+          thumbhash: a.thumbhash,
           exifInfo: a.exifInfo?.copyWith(id: id) ?? exifInfo,
         );
       } else {

+ 2 - 0
mobile/lib/utils/migration.dart

@@ -11,6 +11,8 @@ Future<void> migrateDatabaseIfNeeded(Isar db) async {
       await _migrateTo(db, 2);
     case 2:
       await _migrateTo(db, 3);
+    case 3:
+      await _migrateTo(db, 4);
   }
 }