feat: inline storage columns in remote and local tables

This commit is contained in:
shenlong-tanwen
2025-07-11 01:37:02 +05:30
parent c482bdfae7
commit 023d2195f9
14 changed files with 444 additions and 119 deletions
@@ -1,6 +1,7 @@
import 'package:drift/drift.dart';
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
import 'package:immich_mobile/infrastructure/entities/local_asset.entity.drift.dart';
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.dart';
import 'package:immich_mobile/infrastructure/utils/asset.mixin.dart';
import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
@@ -9,6 +10,11 @@ class LocalAssetEntity extends Table with DriftDefaultsMixin, AssetEntityMixin {
const LocalAssetEntity();
TextColumn get id => text()();
TextColumn get remoteId => text()
.nullable()
.references(RemoteAssetEntity, #id, onDelete: KeyAction.setNull)();
TextColumn get checksum => text().nullable()();
// Only used during backup to mirror the favorite status of the asset in the server
@@ -30,6 +36,6 @@ extension LocalAssetEntityDataDomainEx on LocalAssetEntityData {
isFavorite: isFavorite,
height: height,
width: width,
remoteId: null,
remoteId: remoteId,
);
}