openchs-models 1.33.68 → 1.33.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Schema.js +6 -3
- package/package.json +1 -1
package/dist/Schema.js
CHANGED
|
@@ -828,17 +828,20 @@ function createRealmConfig() {
|
|
|
828
828
|
// AttendanceType) for the new MarkAttendance action. Existing rows
|
|
829
829
|
// remain null.
|
|
830
830
|
}
|
|
831
|
-
if (oldDB.schemaVersion < 214) {
|
|
831
|
+
if (oldDB.schemaVersion >= 212 && oldDB.schemaVersion < 214) {
|
|
832
832
|
// Backfill AttendanceRecord.needsFollowUp from existing follow-up
|
|
833
833
|
// linkage so historical follow-ups survive the first re-save under
|
|
834
|
-
// the new flag-based rule.
|
|
834
|
+
// the new flag-based rule. Skipped when upgrading from < 212, where
|
|
835
|
+
// AttendanceRecord did not exist yet (no rows to backfill).
|
|
835
836
|
_lodash.default.forEach(newDB.objects(_SchemaNames.default.AttendanceRecord), rec => {
|
|
836
837
|
rec.needsFollowUp = !_lodash.default.isNil(rec.followUpEncounterUUID);
|
|
837
838
|
});
|
|
838
839
|
}
|
|
839
|
-
if (oldDB.schemaVersion < 215) {
|
|
840
|
+
if (oldDB.schemaVersion >= 212 && oldDB.schemaVersion < 215) {
|
|
840
841
|
// reasonConceptUUID (single, optional) -> reasonConceptUUIDs (string[]).
|
|
841
842
|
// A set reason becomes a one-element array; null becomes [].
|
|
843
|
+
// Guarded to >= 212: reading oldDB.objects(AttendanceRecord) when the
|
|
844
|
+
// old schema predates the type throws "not found in schema".
|
|
842
845
|
const oldRecords = oldDB.objects(_SchemaNames.default.AttendanceRecord);
|
|
843
846
|
const newRecords = newDB.objects(_SchemaNames.default.AttendanceRecord);
|
|
844
847
|
for (let i = 0; i < oldRecords.length; i++) {
|