onc-healthit / onc-certification-g10-test-kit

ONC Certification (g)(10) Standardized API Tests
Apache License 2.0
32 stars 10 forks source link

Postgres migration issues with "schema_info" table #505

Open austeny opened 3 months ago

austeny commented 3 months ago

I'm experiencing an issue where deploying Inferno to a fresh postgres database runs into the following error. It looks to be an issue with the Sequel migration. I did figure out a workaround where I executed the following command ALTER TABLE schema_info REPLICA IDENTITY FULL; on the database before deploying Inferno which resolved the problem.

(0.000653s) SET standard_conforming_strings = ON
(0.000482s) SET client_min_messages = 'WARNING'
(0.000435s) SET DateStyle = 'ISO'
Begin applying migration version 1, direction: up
ERROR -- : PG::ObjectNotInPrerequisiteState: ERROR:  cannot update table "schema_info" because it does not have a replica identity and publishes updates
HINT: To enable updating the table, set REPLICA IDENTITY using ALTER TABLE.: UPDATE "schema_info" SET "version" = 1
rake aborted!
Sequel::DatabaseError: PG::ObjectNotInPrerequisiteState: ERROR: cannot update table "schema_info" because it does not have a replica identity and publishes updates
HINT: To enable updating the table, set REPLICA IDENTITY using ALTER TABLE.
dehall commented 3 months ago

Thanks for reporting this. That schema_info table is created by Sequel to track which migrations have been run - are you able to share any more details about your postgres configuration so that we can try to reproduce this and report this to their team?

austeny commented 2 months ago

We have followed the guidance from the Inferno Framework Postgres docs. We are using the postgres:14.1-alpine image with our Postgres database deployed within AWS RDS.

I'm not as familiar with Sequel and how it setups the database for migrations. We started from a fresh postgres RDS and ran into the issue when starting Inferno. I'm assuming a solution here would be to create a step in the db migration to run the following command ALTER TABLE schema_info REPLICA IDENTITY FULL;.

dehall commented 2 months ago

Great thanks, I'll look more into that. In the meantime we'll add a note to the instructions on what to do if this error occurs