mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 15:23:29 +00:00
fix(backup): carry four columns the restore was dropping
A column-level round trip over every two-ended model found four values that left with the export and came back empty or re-stamped: - MenstrualCycle.absorbedIntoId: the disaster-recovery file carried the folded, soft-deleted start but not the start that absorbed it, so after a restore removing the absorbing start could no longer bring the folded one back. Carried in the disaster-recovery arm and written back only when the file carries the start it names. - Workout.externalSourceVersion: the source's version marker, stored so the sync can replay it unchanged, was in neither end. Carried beside metadata in the disaster-recovery arm. - NutrientIntakeDay.externalSourceVersion and createdAt: neither was selected, so a restored day lost its source marker and its first-arrival time. Carried in both arms. Files written before this change parse as before; every new field is optional on the way in.
This commit is contained in:
1 parent
f3bf65fb4e
commit
3f5bcbd441
5 files changed
+35
No files matched your search
@@ -559,6 +559,7 @@ const cycleSpanSchema = z
|
||||
tz: z.string().nullable().optional(),
|
||||
syncVersion: z.number().int().optional(),
|
||||
deletedAt: isoDateTime.nullable().optional(),
|
||||
absorbedIntoId: z.string().min(1).nullable().optional(),
|
||||
createdAt: isoDateTime.optional(),
|
||||
updatedAt: isoDateTime.optional(),
|
||||
})
|
||||
@@ -691,6 +692,9 @@ const nutrientDaySchema = z
|
||||
// Closed set in app code rather than a DB enum; kept as a string here so a
|
||||
// future source does not make an old file unparseable.
|
||||
source: z.string().min(1),
|
||||
// Absent from files written before v1.39.7.
|
||||
externalSourceVersion: z.string().nullable().optional(),
|
||||
createdAt: isoDateTime.optional(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
@@ -1641,6 +1645,7 @@ const workoutBackupSchema = z
|
||||
pauseDurationSec: z.number().int().nullable().optional(),
|
||||
source: z.enum(MeasurementSource),
|
||||
externalId: z.string().nullable().optional(),
|
||||
externalSourceVersion: z.string().nullable().optional(),
|
||||
metadata: z.json().optional(),
|
||||
createdAt: isoDateTime.optional(),
|
||||
updatedAt: isoDateTime.optional(),
|
||||
|
||||
Reference in new issue
Block a user