mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-07 04:12:04 +00:00
feat(medications): persist a per-dose configurable intake window
Add `doseWindows` (Json?) to MedicationSchedule: a nullable array of
`{ timeOfDay, start, end }` HH:mm triples naming an explicit on-time
range for a dose time (e.g. 07:00–09:00). A time with no entry keeps the
symmetric ±1h default; a NULL column leaves every slot on the default
derivation, so the migration is additive and changes no existing
behaviour. Migration 0137 adds the column with no backfill.
This commit is contained in:
1 parent
15f648588b
commit
9bb68ade8a
2 files changed
+28
No files matched your search
@@ -0,0 +1,18 @@
|
||||
-- v1.15.18 — per-dose configurable intake WINDOW.
|
||||
--
|
||||
-- Marc's "07:00–09:00" lever: a dose time can carry an explicit on-time RANGE
|
||||
-- instead of the symmetric ±1h default the band minter derives. The column is
|
||||
-- a nullable JSON array of `{ timeOfDay, start, end }` HH:mm triples, one per
|
||||
-- dose time the user gave an explicit window for, e.g.
|
||||
-- [{ "timeOfDay": "07:00", "start": "07:00", "end": "09:00" }]
|
||||
--
|
||||
-- The band minter reads it to build the on-time band from `[start, end]` for
|
||||
-- the matching `timeOfDay`; a time with no entry keeps the default ±1h
|
||||
-- derivation, and a NULL column leaves every slot on the default (unchanged
|
||||
-- behaviour). The late tail stays cadence-derived.
|
||||
--
|
||||
-- Additive + non-destructive: a new nullable column with no backfill. Existing
|
||||
-- rows read NULL and behave exactly as before; the iOS contract gains an
|
||||
-- optional field.
|
||||
ALTER TABLE "medication_schedules"
|
||||
ADD COLUMN "dose_windows" JSONB;
|
||||
@@ -1388,6 +1388,16 @@ model MedicationSchedule {
|
||||
/// v1.7.0 — cyclic "off" weeks. Only meaningful when
|
||||
/// `scheduleType = CYCLIC`.
|
||||
cyclicOffWeeks Int? @map("cyclic_off_weeks")
|
||||
/// v1.15.18 — per-dose on-time intake WINDOW (the configurable lever).
|
||||
/// A JSON array of `{ timeOfDay, start, end }` HH:mm triples, one per
|
||||
/// dose time the user wants an explicit range for (e.g.
|
||||
/// `[{ "timeOfDay": "07:00", "start": "07:00", "end": "09:00" }]`).
|
||||
/// The band minter reads this to build the on-time band from the
|
||||
/// explicit `[start, end]` range for the matching `timeOfDay`; a
|
||||
/// `timeOfDay` with no entry falls back to the symmetric ±1h default.
|
||||
/// The late tail stays cadence-derived. NULL = every slot uses the
|
||||
/// default derivation (unchanged behaviour). Additive + iOS-safe.
|
||||
doseWindows Json? @map("dose_windows")
|
||||
|
||||
medication Medication @relation(fields: [medicationId], references: [id], onDelete: Cascade)
|
||||
telegramMessages TelegramReminderMessage[]
|
||||
|
||||
Reference in new issue
Block a user