Files
HealthLog/prisma/migrations/0146_v1165_schedule_revision_source/migration.sql
T
Marc-André Bombeck 5639da4333 feat(medications,admin): the schedule's history is visible and invites count their uses
The schedule tab shows its eras as a collapsible timeline — current
plan since its date, predecessors with their times and span — and a
past era can be added manually for old history, with validation against
overlaps and the live plan. Invite creation chooses one to fifty uses
and the redemption list scrolls.
2026-06-11 11:45:58 +02:00

20 lines
896 B
SQL

-- v1.16.5 — schedule-revision provenance.
--
-- The Zeitplan tab now lets a user append a PRE-tracking era by hand
-- ("the medication dosed at 07:00/19:00 from March to June, before I
-- edited it here"). Those rows are user-entered, not write-path
-- archives, so they must stay deletable without touching the archive
-- the schedule-replace path mints.
--
-- `source` records the provenance:
-- 'ARCHIVED' — minted by the wholesale-replace write path (immutable
-- history; never deletable through the API).
-- 'MANUAL' — entered through POST
-- /api/medications/{id}/schedule-revisions (deletable by
-- the owner).
--
-- Additive + non-destructive: every existing row is a write-path
-- archive, so the default backfills correctly.
ALTER TABLE "medication_schedule_revisions"
ADD COLUMN "source" TEXT NOT NULL DEFAULT 'ARCHIVED';