mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 06:40:50 +00:00
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.
17 lines
706 B
SQL
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'));
|