Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Old fastSync restore fails with association error, for a subject that was part of a subject migration. #1171

Open
2 tasks
himeshr opened this issue Nov 3, 2023 · 0 comments

Comments

@himeshr
Copy link
Contributor

himeshr commented Nov 3, 2023

Describe the bug
Old fastSync restore fails with association error, for a subject that was part of a subject migration.
Related to Freshdesk ticket

To Reproduce
Steps to reproduce the behavior:

  1. Ensure that you backup latest fast-sync file on s3, rename "MobileDbBackup-a603e38d-9945-4f9d-a40e-8692bb2b1449" to "MobileDbBackup-a603e38d-9945-4f9d-a40e-8692bb2b1449_TO_BE_REPLACED"
  2. Rename "MobileDbBackup-a603e38d-9945-4f9d-a40e-8692bb2b1449_BKP_01_nov_2023" to "MobileDbBackup-a603e38d-9945-4f9d-a40e-8692bb2b1449"
  3. Login as "pattavayal" user "Ashwini" org
  4. Due to use of old fast-sync, sync fails with association error
  5. The values specified for ProgramEncounter and ProgramEnrolment in the error are all valid and linked to each other correctly
  6. Rename "MobileDbBackup-a603e38d-9945-4f9d-a40e-8692bb2b1449" to "MobileDbBackup-a603e38d-9945-4f9d-a40e-8692bb2b1449_BKP_01_nov_2023"
  7. Restore latest fast sync back by renaming "MobileDbBackup-a603e38d-9945-4f9d-a40e-8692bb2b1449_TO_BE_REPLACED" to "MobileDbBackup-a603e38d-9945-4f9d-a40e-8692bb2b1449"

##Additional info

The Individual related the the errored ProgramEnrolment was part of a subjectMigration.

select * from subject_migration where individual_id = 29202;
-- "23362","eca86b41-046a-444b-87c6-58cf6ebf3bd1","29202","367","173","10","5967166","false","0","2328","2328","2022-07-28 04:33:11.788 +00:00","2022-07-28 04:33:11.788 +00:00",,,,,"141",

/* Related SQLs*/
select * from encounter where individual_id = 29202;
select * from individual where id = 29202;
select * from program_encounter where uuid = '64f62f54-8361-45c2-a1de-3773a8a28c07'; /*enro = 151205*/
-- select * from encounter where uuid = '1033bfbc-f3c7-4a15-8d71-4e0ed66550d6';
select * from program_enrolment where uuid like '030820db-5e14%'; /*151205 = '030820db-5e14-42ea-ae60-c3194c8aae42'*/

Expected behavior
Sync should complete successfully even with old fastSync file

Smartphone (please complete the following information):

  • Version: 5.0.4

Developer Checklist
Developer fixing the bug should fill this checklist.

  • Does the fix require extensive regression testing?
  • Are you mentioning the required scenarios that could be affected?
@github-project-automation github-project-automation bot moved this to New Issues in Avni Product Nov 3, 2023
@himeshr himeshr moved this from New Issues to Analysis Complete in Avni Product Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Analysis Complete
Development

No branches or pull requests

1 participant