mirror of
https://github.com/immich-app/immich.git
synced 2026-07-28 14:47:30 -07:00
cover epoch dates in both local asset tables
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user