immich/mobile/lib/utils/migration.dart
Fynn Petersen-Frey 116043b2b4
feat(mobile): use efficient sync (#8842)
* feat(mobile): use efficient sync

review feedback

* adapt to changed  server endpoints

* formatting

* fix memory lane bug

* fix: bad merge

* fix call not returning correct number of asset

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
2024-05-14 10:35:37 -05:00

20 lines
510 B
Dart

import 'dart:async';
import 'package:immich_mobile/entities/store.entity.dart';
import 'package:immich_mobile/utils/db.dart';
import 'package:isar/isar.dart';
const int targetVersion = 6;
Future<void> migrateDatabaseIfNeeded(Isar db) async {
final int version = Store.get(StoreKey.version, 1);
if (version < targetVersion) {
_migrateTo(db, targetVersion);
}
}
Future<void> _migrateTo(Isar db, int version) async {
await clearAssetsAndAlbums(db);
await Store.put(StoreKey.version, version);
}