use a separate table instead of a column on remote asset

This commit is contained in:
shenlong-tanwen
2025-09-06 01:50:48 +05:30
parent 5236a72fb3
commit 03cd491197
16 changed files with 853 additions and 216 deletions
@@ -75,14 +75,19 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {
Future<List<LocalAssetHashMapping>> getHashMappingFromCloudId() async {
final query =
_db.localAssetEntity.selectOnly().join([
leftOuterJoin(
_db.remoteAssetCloudIdEntity,
_db.localAssetEntity.cloudId.equalsExp(_db.remoteAssetCloudIdEntity.cloudId),
useColumns: false,
),
leftOuterJoin(
_db.remoteAssetEntity,
_db.localAssetEntity.cloudId.equalsExp(_db.remoteAssetEntity.cloudId),
_db.remoteAssetCloudIdEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
useColumns: false,
),
])
..addColumns([_db.localAssetEntity.id, _db.remoteAssetEntity.checksum])
..where(_db.remoteAssetEntity.cloudId.isNotNull() & _db.localAssetEntity.checksum.isNull());
..where(_db.remoteAssetCloudIdEntity.cloudId.isNotNull() & _db.localAssetEntity.checksum.isNull());
return query
.map(
(row) => (assetId: row.read(_db.localAssetEntity.id)!, checksum: row.read(_db.remoteAssetEntity.checksum)!),