mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +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.
25 lines
1.0 KiB
SQL
25 lines
1.0 KiB
SQL
-- AI usage in three levels (#1217).
|
|
--
|
|
-- An account picks frugal, standard or full; the operator sets the highest
|
|
-- level an account may pick and the level an account without its own choice
|
|
-- runs at. `ai_sync_regen_gap_hours` is the minimum gap between status-card
|
|
-- regenerations after a sync at `standard` (NULL = env or 6 h). Both
|
|
-- instance defaults are STANDARD; an account's stored NULL follows the
|
|
-- instance default.
|
|
|
|
-- CreateEnum
|
|
CREATE TYPE "ai_usage_level" AS ENUM ('FRUGAL', 'STANDARD', 'FULL');
|
|
|
|
-- AlterTable
|
|
ALTER TABLE "users" ADD COLUMN "ai_usage_level" "ai_usage_level";
|
|
|
|
-- AlterTable
|
|
ALTER TABLE "app_settings"
|
|
ADD COLUMN "ai_usage_max_level" "ai_usage_level" NOT NULL DEFAULT 'STANDARD',
|
|
ADD COLUMN "ai_usage_default_level" "ai_usage_level" NOT NULL DEFAULT 'STANDARD',
|
|
ADD COLUMN "ai_sync_regen_gap_hours" INTEGER;
|
|
|
|
ALTER TABLE "app_settings"
|
|
ADD CONSTRAINT "app_settings_ai_sync_regen_gap_hours_check"
|
|
CHECK ("ai_sync_regen_gap_hours" IS NULL OR "ai_sync_regen_gap_hours" BETWEEN 1 AND 48);
|