Bahmni-core liquibase migration failing

Description

There's been few migrations added to the bahmni-core as part of this card and commit details
https://github.com/Bahmni/bahmni-core/commit/70090be4169b44852f5f7f3ba333e4f159da5f73

And a precondition is added to the existing change set. As there is problem with the precondition check the migration is failing and unable to start the bahmni-core module.

<changeSet id="bahmni-core-201906201150" author="Mihir,Vinay"> <preConditions onFail="MARK_RAN"> <sqlCheck expectedResult="0"> select count(*) from concept_name cn inner join concept c on cn.concept_id = c.concept_id where cn.name = 'REFERRED_OUT' and cn.concept_name_type = 'FULLY_SPECIFIED' and c.datatype_id = (SELECT concept_datatype_id FROM concept_datatype WHERE name = 'N/A') and c.class_id = (SELECT concept_class_id FROM concept_class WHERE name = 'Misc'); </sqlCheck> </preConditions> <comment>Add new concept to mark referred out tests</comment> <sql> set @concept_id = 0; set @concept_name_short_id = 0; set @concept_name_full_id = 0; set @labresults_concept_id = 0; set @answer_concept_id = 0; call add_concept(@concept_id, @concept_name_short_id, @concept_name_full_id,'REFERRED_OUT','REFERRED_OUT', 'N/A', '`Misc`', true); select @labresults_concept_id := concept_id, min(concept_id) from concept_name where name = 'LABRESULTS_CONCEPT' GROUP BY concept_id; set @set_concept_id = @concept_id; call add_concept_set_members (@labresults_concept_id,@set_concept_id,1); </sql> </changeSet>

Steps to Reproduce:

Replace bahmni-core with latest bahmni-core.omod built from master.

Notes: This issue reproducible in only few instances specific to mysql 5.7. version. In lower mysql version the pre-check condition has failed and eventually the migration has passed. In mysql 5.7, the pre-check condition has passed and trying to insert the REFERRED_OUTconcept and as its already there the migration has failed.

on mysql 5.7:

on mysql 5.6:

PR Linkhttps://github.com/Bahmni/bahmni-core/pull/74/

Activity

Show:
Himabindu Thungathurty
September 23, 2020, 7:00 PM
Edited

Whatever the mysql version it is, REFERRED_OUT concept datatype is of type “Boolean” in the database. As the pre-condition check for datatype “N/A” the migration is trying to insert duplicate entry and failing. So removing the check on datatype in pre-condition will solve the issue.

PR for the same → https://github.com/Bahmni/bahmni-core/pull/74/

Himabindu Thungathurty
October 28, 2020, 4:57 AM

has merged the PR

Assignee

Himabindu Thungathurty

Reporter

Himabindu Thungathurty

Labels

None

Units

None

PercentDone

None

DueTime

None

Clients

None

External issue ID

None

UAT Assignee

None

Reviewer

None

Sprint

0.93 Product M3

Fix versions

Configure