summaryrefslogtreecommitdiff
path: root/internal/repository/migrate.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-03 19:17:04 +0300
committerPaul Buetow <paul@buetow.org>2026-05-03 19:17:04 +0300
commit30c2b0fe8232cc748ab2bded6ab4d76febe32425 (patch)
tree985578b326a1ff8fe7af395bf08471857376b8fc /internal/repository/migrate.go
parent687b86cdeef2192272f0945ddd496322a9113f9e (diff)
fix(admin): fix rescan goroutine lifecycle and race on shared ScanProgress
- Protect adminService scan state (cancel func + progress pointer) with sync.Mutex. - Allocate fresh ScanProgress per trigger and pass it to the scanner, eliminating races on the previously shared progress struct. - Cancel previous scan context before starting a new one. - Add tests for cancellation, fresh progress per scan, concurrent triggers, and empty progress when never started. - Fix race-prone tests by polling Running==true before waiting for completion.
Diffstat (limited to 'internal/repository/migrate.go')
-rw-r--r--internal/repository/migrate.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/repository/migrate.go b/internal/repository/migrate.go
index 60cea03..3c1e8bb 100644
--- a/internal/repository/migrate.go
+++ b/internal/repository/migrate.go
@@ -42,12 +42,21 @@ CREATE TABLE IF NOT EXISTS media (
rel_path TEXT NOT NULL,
file_name TEXT NOT NULL,
abs_path TEXT NOT NULL,
- type TEXT CHECK(type IN ('video','audio')) NOT NULL,
+ type TEXT CHECK(type IN ('video','audio','image')) NOT NULL,
duration REAL,
codec TEXT,
resolution TEXT,
bitrate INTEGER,
file_size_bytes INTEGER,
+ width INTEGER,
+ height INTEGER,
+ exif_camera TEXT,
+ exif_lens TEXT,
+ exif_date TEXT,
+ exif_iso TEXT,
+ exif_f_number TEXT,
+ exif_exposure TEXT,
+ exif_focal_length TEXT,
thumbnail_path TEXT,
play_count INTEGER NOT NULL DEFAULT 0,
deleted_at DATETIME,