diff --git a/internal/entity/file.go b/internal/entity/file.go index dbe4a707b..5b3165ec1 100644 --- a/internal/entity/file.go +++ b/internal/entity/file.go @@ -12,6 +12,8 @@ import ( // An image or sidecar file that belongs to a photo type File struct { Model + CreatedIn int64 + UpdatedIn int64 Photo *Photo PhotoID uint `gorm:"index;"` PhotoUUID string `gorm:"index;"` diff --git a/internal/photoprism/indexer_mediafile.go b/internal/photoprism/indexer_mediafile.go index 80f63b858..932710caf 100644 --- a/internal/photoprism/indexer_mediafile.go +++ b/internal/photoprism/indexer_mediafile.go @@ -22,6 +22,8 @@ const ( type IndexResult string func (i *Indexer) indexMediaFile(m *MediaFile, o IndexerOptions) IndexResult { + start := time.Now() + var photo entity.Photo var file, primaryFile entity.File var exifData *Exif @@ -211,10 +213,13 @@ func (i *Indexer) indexMediaFile(m *MediaFile, o IndexerOptions) IndexResult { } if fileQuery.Error == nil { + file.UpdatedIn = int64(time.Since(start)) i.db.Unscoped().Save(&file) return indexResultUpdated } + file.CreatedIn = int64(time.Since(start)) + i.db.Create(&file) return indexResultAdded }