...
Note: Skip step 7 and 8 on that page since we want to hash the data before migrating to the postgres model.
Enable the package uuid-ossp to enable random uuid generation on postgres. Run the below command on psql prompt
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
Run the below script to Create a function for generating a random number within a range
Code Block | ||||
---|---|---|---|---|
| ||||
CREATE FUNCTION random_between(low integer, high integer)
RETURNS integer
STRICT
LANGUAGE plpgsql
AS $$
BEGIN
RETURN floor(random()* (high-low + 1) + low);
END;
$$; |
To hash the data use the below steps in sequential order. You must be having the couchdb
table in the OpenSRP postgres database that will store the hashed data before starting
...