feat(db/m7-recurring-scans): migration 0019 + sqlc queries

Adds the singleton scan_schedule table holding the operator's
recurring-scan config. mode is the discriminator (off/interval/
daily/weekly); CHECK constraints enforce per-mode field validity
(interval_hours required for interval; time_of_day for daily and
weekly; weekly_day 1..7 for weekly). Seed row is mode='off'.

Two new queries: GetScanSchedule (read singleton; used by scheduler
boot + admin GET) and UpdateScanSchedule (admin PATCH; application
normalizes per-mode fields to NULL when mode='off').
This commit is contained in:
2026-05-06 22:12:27 -04:00
parent 6e985cf532
commit e27d030e68
5 changed files with 122 additions and 0 deletions
+9
View File
@@ -393,6 +393,15 @@ type ScanRun struct {
ArtistArtEnrich []byte
}
type ScanSchedule struct {
ID bool
Mode string
IntervalHours *int32
TimeOfDay *string
WeeklyDay *int32
UpdatedAt pgtype.Timestamptz
}
type ScrobbleQueue struct {
ID pgtype.UUID
UserID pgtype.UUID