Files
HealthLog/prisma/migrations/0332_schedule_units_per_dose/migration.sql
T
Marc-André Bombeck 0e34f9edda feat(medications): add per-schedule units-per-dose column
Add a nullable units_per_dose to medication_schedules so a split-dose
plan can consume a different unit count at different times of day (a
whole tablet in the morning, a half at noon) on ONE medication instead
of two. NULL inherits the medication-level units_per_dose, so every
existing row keeps its current behaviour. Migration 0332 adds one
nullable Decimal(10,4) column with no backfill.
2026-08-10 07:58:48 +02:00

7 lines
419 B
SQL

-- #219 — per-schedule inventory units consumed per dose.
-- Additive, nullable, no backfill: every existing schedule row reads NULL and
-- the consume hook keeps inheriting the medication-level `units_per_dose`, so
-- behaviour is unchanged until a user sets a per-slot value. Same
-- Decimal(10,4) grain as `medications.units_per_dose`.
ALTER TABLE "medication_schedules" ADD COLUMN "units_per_dose" DECIMAL(10,4);