mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 05:12:14 +00:00
R-E H-5. Up to v0.4.1.1 the iOS app stored mood-entry prose as `tags: ["note:<text>"]` because the server had no dedicated column. The workaround contaminated the tags axis with prose the Coach evidence shelf misread as taxonomic labels. Schema (migration 0063, additive): - mood_entries.note (TEXT, nullable) Validation + routes: - createMoodEntrySchema gains optional note (max 500 chars) - updateMoodEntrySchema accepts note + null to clear - POST /api/mood-entries persists note alongside tags - PUT /api/mood-entries/[id] honours partial note updates - POST /api/mood-entries/bulk carries note through the bulk path Backfill script at scripts/backfill-mood-note-column.ts lifts the legacy note:<text> tag entries into the new column. Idempotent dry-run mode is the default; --confirm commits. Helper logic lives in src/lib/mood/note-backfill.ts for tight unit coverage. iOS contract: additive. Old iOS payloads (no note field) round-trip unchanged. New iOS code paths can read or write note without touching tags.
17 lines
759 B
SQL
17 lines
759 B
SQL
-- v1.4.30 — MoodEntry.note column (R-E H-5)
|
|
--
|
|
-- Replaces the `tags: ["note:<text>"]` workaround the iOS app
|
|
-- shipped through v0.4.1.1. The prior shape contaminated the tags
|
|
-- axis with prose that the Coach evidence shelf misread as
|
|
-- taxonomic labels. The new column is a first-class free-text
|
|
-- field; the bulk-backfill migration script (run separately by the
|
|
-- operator) pulls existing `note:...` tag entries into this column.
|
|
--
|
|
-- Additive-only — the column is nullable, no existing row needs
|
|
-- updating for the schema migration itself to apply cleanly. The
|
|
-- `IF NOT EXISTS` guard keeps this idempotent against partial
|
|
-- historical runs (same posture as 0058 and 0061).
|
|
|
|
ALTER TABLE "mood_entries"
|
|
ADD COLUMN IF NOT EXISTS "note" TEXT;
|