Files
HealthLog/prisma/migrations/0408_intraday_hour_buckets/migration.sql
T
Marc-André Bombeck 6e72de1c35 feat(db): add the v1.43 schema and drop the readable location columns
Migrations 0402 to 0410: AI usage levels, biomarker aliases and merges,
medication ingredients (with the supplement label run kind), life
circumstance fact kinds, AI sections and AUDIT-C, Dawarich context, the
pulse day-mean method, intraday hour buckets, the readable location drop
and five relation link tables. Every new column carries its reader or a
pending-consumer marker.

0409 refuses to run while any home, location period or stored day still
holds a readable location, and names the counts. Locations are read from
the sealed copy only; the encryption backfill no longer handles them, and
the demo seed writes sealed locations only.

The new tables are backed up and wiped, the new sealed columns are in the
rotation registry with labels of their own, the AI usage level and the
life-circumstance confirmations travel with the backup, and the wellbeing
score reads the mental-health screeners only.
2026-10-15 21:48:57 +02:00

17 lines
706 B
SQL

-- Hour buckets for summed intraday types (ios #77).
--
-- A day of steps, active energy, distance or flights can be built from the
-- hourly `stats:<HK>:<YYYY-MM-DD>T<HH>` rows the app posts instead of the fold
-- of single samples. The hour increments live beside the running totals;
-- `basis` says which source built the profile.
-- AlterTable
ALTER TABLE "intraday_cumulative_profiles"
ADD COLUMN "hourly_increments" DOUBLE PRECISION[],
ADD COLUMN "basis" TEXT NOT NULL DEFAULT 'PER_SAMPLE',
ADD COLUMN "bucket_count" INTEGER;
ALTER TABLE "intraday_cumulative_profiles"
ADD CONSTRAINT "intraday_cumulative_profiles_basis_check"
CHECK ("basis" IN ('PER_SAMPLE', 'HOUR_BUCKETS'));