[MS-1501] implement db migration backfilling empty referenceIds#1738
Open
meladRaouf wants to merge 1 commit into
Open
[MS-1501] implement db migration backfilling empty referenceIds#1738meladRaouf wants to merge 1 commit into
meladRaouf wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Implements data migrations to backfill previously-empty referenceId values for biometric samples/templates so that legacy enrolments (created before referenceId existed) receive stable, non-empty IDs grouped per subject + modality across both Realm and Room storage.
Changes:
- Add Room DB migration
2 -> 3to backfill emptyDbBiometricTemplate.referenceIdper(subjectId, modality)and bumpSubjectsDatabaseversion to 3. - Add instrumentation migration test to verify Room backfill behavior and preservation of existing
referenceIds. - Add Realm schema migration
18 -> 19to backfill empty samplereferenceIds per modality and bump Realm schema version to 19 (with a unit test).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| infra/enrolment-records/room-store/src/test/java/com/simprints/infra/enrolment/records/room/store/migration/Migration2to3Test.kt | Adds instrumentation coverage for the Room 2→3 backfill migration. |
| infra/enrolment-records/room-store/src/main/java/com/simprints/infra/enrolment/records/room/store/SubjectsDatabase.kt | Registers the new Room migration and bumps DB version to 3. |
| infra/enrolment-records/room-store/src/main/java/com/simprints/infra/enrolment/records/room/store/migration/SubjectMigration2to3.kt | Implements Room 2→3 backfill of empty referenceId per (subjectId, modality). |
| infra/enrolment-records/room-store/schemas/com.simprints.infra.enrolment.records.room.store.SubjectsDatabase/3.json | Adds exported Room schema snapshot for v3. |
| infra/enrolment-records/realm-store/src/test/java/com/simprints/infra/enrolment/records/realm/store/migration/RealmMigrationsTest.kt | Adds test coverage for Realm 18→19 referenceId backfill behavior. |
| infra/enrolment-records/realm-store/src/main/java/com/simprints/infra/enrolment/records/realm/store/migration/RealmMigrations.kt | Implements Realm 18→19 backfill of empty sample referenceIds per modality. |
| infra/enrolment-records/realm-store/src/main/java/com/simprints/infra/enrolment/records/realm/store/config/RealmConfig.kt | Bumps Realm schema version to 19 to activate the new migration. |
c03c2be to
95f85ae
Compare
95f85ae to
fc71b41
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



MS-1501
Will be released in: v2026.3.0
Root cause analysis (for bugfixes only)
First known affected version: v2025.1.0
referenceIdwas added to face/fingerprint samples in v2025.1.0 , but no migration backfilled it for existing samples — Realm defaulted it to"".DbBiometricTemplate, leaving subjects enrolled before v2025.1.0 with a permanently emptyreferenceIdafter upgrade.Notable changes
RealmMigrations(schema → v19): backfills a shared UUID per subject+modality for samples with emptyreferenceId.SubjectMigration2to3(Room DB → v3): same backfill applied toDbBiometricTemplaterows.referenceIds are left untouched.Testing guidance
SELECT * FROM DbBiometricTemplate WHERE referenceId=''returns no rows.Migration2to3TestandRealmMigrationsTest.