[web-db] implement function to get database version
Summary:
Extract previous code and add necessary validation.
Depends on D7101
Test Plan: Spawn worker and check if version is properly printed
Reviewers: michal, tomek
Reviewed By: michal
Subscribers: ashoat, atul
Differential Revision: https://phab.comm.dev/D7102