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

CRVS: Server Version Bug #2024

Closed
ageryck opened this issue Apr 13, 2022 · 2 comments
Closed

CRVS: Server Version Bug #2024

ageryck opened this issue Apr 13, 2022 · 2 comments
Assignees
Labels
bug Something isn't working CRVS UNICEF HQ

Comments

@ageryck
Copy link

ageryck commented Apr 13, 2022

On newly created updates on OpenSRP regarding server version as documented on this PR and this PR. There seems to be a bug where by the original migrated records had incrementing values of server version however newly entered records from OpenSRP Web do not seem to increment the value, it saves 0
See sample below from practitioners endpoint;

` {
        "identifier": "4840697e-8048-4c0b-9f51-5c11d57496ee",
        "active": true,
        "name": "crvs9 Trainer",
        "userId": "2ed0df4f-9105-4c48-9298-33264d834874",
        "username": "crvs9",
        "dateCreated": "2022-02-25T08:32:35.831Z",
        "dateEdited": "2022-02-25T08:32:35.831Z",
        "serverVersion": 0
    },`
@ageryck ageryck added bug Something isn't working CRVS UNICEF HQ labels Apr 13, 2022
@ageryck
Copy link
Author

ageryck commented Apr 21, 2022

Found out that some of the entries did not migrate successfully and were indicating null in the database. Needs to review the Migration script in the above mentioned PR's.
Quick solution was to rerun the server version assignment on the database, we achieved that by a temp query below;

do $$
declare 
   counter integer := 0;
   
begin
   while counter < 48 loop  --SET COUNT TO max rows
      --******************
		begin	  
	  	UPDATE team.organization
		SET server_version = (SELECT nextval('team.organization_server_version_seq'))
		WHERE id = counter;
		end;
	  --******************
	  counter := counter + 1;
   end loop;
end$$;

@ageryck
Copy link
Author

ageryck commented Apr 21, 2022

we equally validated that the endpoints works well and for new records the serverversion assignment is happening correctly

@ageryck ageryck closed this as completed Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CRVS UNICEF HQ
Projects
None yet
Development

No branches or pull requests

2 participants