1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-21 01:39:59 +02:00
immich/mobile/lib/utils/migration.dart
Fynn Petersen-Frey 9fa9ad05b1
feat(mobile): unify partner assets on timeline (#4974)
* feat(mobile): unify partner assets on timeline

* skip non-owned assets in bulk actions

* add message when trying to delete partner assets
2023-11-13 09:54:41 -06:00

23 lines
560 B
Dart

import 'dart:async';
import 'package:immich_mobile/shared/models/store.dart';
import 'package:immich_mobile/utils/db.dart';
import 'package:isar/isar.dart';
Future<void> migrateDatabaseIfNeeded(Isar db) async {
final int version = Store.get(StoreKey.version, 1);
switch (version) {
case 1:
await _migrateTo(db, 2);
case 2:
await _migrateTo(db, 3);
case 3:
await _migrateTo(db, 4);
}
}
Future<void> _migrateTo(Isar db, int version) async {
await clearAssetsAndAlbums(db);
await Store.put(StoreKey.version, version);
}