cover epoch dates in both local asset tables

This commit is contained in:
Santo Shakil
2026-07-24 02:35:21 +06:00
parent f400d5eb13
commit b35fe5debf
2 changed files with 20 additions and 3 deletions
@@ -174,8 +174,8 @@ open class NativeSyncApiImplBase(context: Context) : ImmichPlugin(), ActivityAwa
MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO -> 2L
else -> 0L
}
// Date taken is in ms; added/modified are in seconds. No-EXIF assets use the earliest
// positive modified/added date, or added if neither is positive.
// Date taken is in ms; added/modified are in seconds, and modified can be 0 when unset.
// No-EXIF assets use the earliest positive added/modified date, or raw added if neither is positive.
val modifiedAt = c.getLong(dateModifiedColumn)
val addedAt = c.getLong(dateAddedColumn)
val createdAt = (c.getLong(dateTakenColumn).takeIf { it > 0 }?.div(1000))
+18 -1
View File
@@ -102,15 +102,32 @@ void main() {
source: TrashOrigin.localSync,
),
);
await db
.into(db.trashedLocalAssetEntity)
.insert(
TrashedLocalAssetEntityCompanion.insert(
id: 'trashed-epoch',
albumId: 'album',
name: 'trashed-epoch.jpg',
type: AssetType.image,
createdAt: drift.Value(createdAt),
updatedAt: drift.Value(epoch),
source: TrashOrigin.localSync,
),
);
await migrateDatabaseIfNeeded(db);
final local = await (db.select(db.localAssetEntity)..where((row) => row.id.equals('local'))).getSingle();
final unchanged = await (db.select(db.localAssetEntity)..where((row) => row.id.equals('epoch'))).getSingle();
final trashed = await db.select(db.trashedLocalAssetEntity).getSingle();
final trashed = await (db.select(db.trashedLocalAssetEntity)..where((row) => row.id.equals('trashed'))).getSingle();
final trashedUnchanged = await (db.select(
db.trashedLocalAssetEntity,
)..where((row) => row.id.equals('trashed-epoch'))).getSingle();
expect(local.createdAt, updatedAt);
expect(unchanged.createdAt, createdAt);
expect(trashed.createdAt, updatedAt);
expect(trashedUnchanged.createdAt, createdAt);
expect(await storeRepository.tryGet(StoreKey.version), 27);
});
}