Upgrade from 2.x to 2.7

Upgrade from 2.x to 2.7

FHIR BLOBs


Hapi-fhir-jpaserver is used alongside OpenELIS to provide FHIR support. Older versions of the project made extensive use of the Postgres BLOB data type. This data type cannot be handled in the same way as "normal" Postgres data types. Because of this, upgrading a large DB with many BLOBs takes a long time, is very memory intensive, and is prone to failing if enough memory isn't available. Due to these reasons, it is recommended to upgrade your hapi-fhir-jpaserver to at least 6.6.0 before upgrading your DB, so you can run the reindex command which moves all resources (smaller than a configurable limit) into the normal table structure.

Instructions for updating FHIR BLOBs

  1. Stop the existing containers besides the database

    1. sudo docker stop openelisglobal-webapp autoheal-oe external-fhir-api

  2. Collect metrics around the data to see what you're working with

    1. sudo docker exec -it openelisglobal-database psql -Uclinlims

    2. SELECT COUNT(*) FROM clinlims.hfj_res_ver;

    3. SELECT pg_table_size('pg_largeobject');

  3. Run the script for upgrading hapi-fhir-jpaserver data structure in the database

    1. wget https://github.com/hapifhir/hapi-fhir/releases/download/v6.2.0/hapi-fhir-6.2.0-cli.tar.bz2

    2. bzip2 -d hapi-fhir-6.2.0-cli.tar.bz2

    3. tar xf hapi-fhir-6.2.0-cli.tar

    4. ./hapi-fhir-cli migrate-database -d POSTGRES_9_4 -u "jdbc:postgresql://localhost:15432/clinlims currentSchema=clinlims" -n "clinlims" --no-column-shrink -p <password>