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.
This commit is contained in:
Marc-André Bombeck committed 2026-10-15 21:48:57 +02:00
1 parent 0b64b80343
commit 6e72de1c35
45 files changed
+1386 -917

No files matched your search

+18 -2
View File
@@ -306,6 +306,8 @@ async function main() {
"googleHealthClientSecretEncrypted",
"nightscoutUrlEncrypted",
"nightscoutTokenEncrypted",
"dawarichUrlEncrypted",
"dawarichApiKeyEncrypted",
"polarAccessTokenEncrypted",
"polarUserIdEncrypted",
"polarClientIdEncrypted",
@@ -825,8 +827,8 @@ async function main() {
// ───── v1.42 environment locations (Bytes, binary2, batched) ─────
// The sealed home, each dated location period and each day's resolved
// location, all under the environment-location label. NULL on a row the
// encryption backfill has not reached yet, which the walk skips.
// location, all under the environment-location label. NULL on a row
// without a location, which the walk skips.
results.push(
await rotateRegistryColumn("User", "homeLocationEncrypted", {
user: prisma.user,
@@ -847,6 +849,20 @@ async function main() {
} as unknown as CorpusClient),
);
// ───── v1.43 Dawarich context (Bytes, binary2, batched) ─────
// The sealed connection preferences on the user row and each stored day's
// country code, each under its own label. NULL rows are skipped.
results.push(
await rotateRegistryColumn("User", "dawarichPrefsEncrypted", {
user: prisma.user,
} as unknown as CorpusClient),
);
results.push(
await rotateRegistryColumn("DawarichDay", "countryCodeEncrypted", {
dawarichDay: prisma.dawarichDay,
} as unknown as CorpusClient),
);
// ───── v1.39.3 custom-metric reading note (Bytes column) ─────
// NULL on a reading without a note, and on a row the free-text backfill has
// not reached yet; `rotateBytesColumn` skips both.
+2 -15
View File
@@ -499,13 +499,7 @@ async function seed() {
// start of a chart together. Every other tile stays one switch away in
// the layout settings; its data is seeded either way. Writing the layout
// verbatim keeps the demo's home page stable across default tweaks.
const SHOWCASE_TILE_IDS = new Set([
"weight",
"bp",
"pulse",
"hrv",
"mood",
]);
const SHOWCASE_TILE_IDS = new Set(["weight", "bp", "pulse", "hrv", "mood"]);
const demoDashboardLayout = serializeDashboardLayout({
...DEFAULT_DASHBOARD_LAYOUT,
widgets: DEFAULT_DASHBOARD_LAYOUT.widgets.map((w) => ({
@@ -2798,12 +2792,11 @@ async function seed() {
}
// The timeline module is opt-in; the demo shows it. The home location
// is sealed the way the settings route writes it (readable columns null).
// is sealed the way the settings route writes it.
const homeSince = daysAgoAt(HISTORY_DAYS, 12);
await client.query(
`UPDATE users
SET module_preferences_json = $2,
home_lat = NULL, home_lon = NULL, home_label = NULL,
home_location_encrypted = $3,
home_timezone = 'Europe/Berlin',
home_since = $4,
@@ -2913,9 +2906,6 @@ async function seed() {
cuid(),
userId,
key,
null,
null,
null,
away ? sealedHoliday : sealedHome,
away ? "TRAVEL" : "HOME",
tempMin,
@@ -2964,9 +2954,6 @@ async function seed() {
"id",
"user_id",
"date",
"lat",
"lon",
"location_label",
"location_encrypted",
"source",
"temp_min",