mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 06:52:04 +00:00
Append an MCP value to MeasurementSource (migration 0196, additive enum extension) so a row logged through the remote MCP endpoint is distinguishable from MANUAL/TELEGRAM provenance and gets an isolated idempotency namespace (userId, type, MCP, externalId). The value joins the read enum so existing read/response shapes decode the rows; the REST batch and single-POST write surfaces still reject it (server-resolved only). Regenerate the OpenAPI contract for the additive enum.
15 lines
812 B
SQL
15 lines
812 B
SQL
-- MCP write provenance.
|
|
--
|
|
-- The remote MCP endpoint gains a confirmed write surface (logging a
|
|
-- measurement / mood). Rows it writes carry their own `MeasurementSource`
|
|
-- value so they are distinguishable from MANUAL / TELEGRAM provenance and
|
|
-- get an isolated idempotency namespace `(userId, type, MCP, externalId)`.
|
|
--
|
|
-- Purely-additive enum extension; no row touched. `ADD VALUE IF NOT EXISTS`
|
|
-- makes a rerun safe. The new value is NOT used elsewhere in this migration,
|
|
-- so it is safe to extend the enum in the same step (Postgres only forbids
|
|
-- USING a freshly-added value in the same transaction). Mirrors the 0189
|
|
-- source-extension that added TELEGRAM. The enum is `@@map`-ed to the
|
|
-- snake_case type name `measurement_source`.
|
|
ALTER TYPE "measurement_source" ADD VALUE IF NOT EXISTS 'MCP';
|