Platform 1.10.0, Platform 1.10.1, Platform 1.11.0, Platform 1.11.1
In liquibase changeset 201406152043, introduced in OpenMRS 1.10, we add a foreign key that is invalid.
The intent seems to be to add a foreign key from order_type.parent back to order_type, but instead it incorrectly tries to add the link between order_type.parent and order.
The liquibase changeset was introduced in TRUK-4395 as follows:
<changeSet id="201406152043" author="harsz89"> <preConditions onFail="MARK_RAN"> <not><foreignKeyConstraintExists foreignKeyName="order_type_parent"/></not> </preConditions> <comment>Adding foreign key constraint from order_type.parent column to order_type.order_type_id column</comment> <addForeignKeyConstraint baseTableName="order_type" baseColumnNames="parent" constraintName="order_type_parent" referencedTableName="order_type" referencedColumnNames="order_type_id"/> </changeSet>
The result is that any existing implementations with order types and orders will either end up with an upgrade failure (if links to non-existent rows are found), or worse - will end up with links to the wrong tables altogether.
This is a high-priority issue that should be fixed in master and backported back through the 1.11.x and 1.10.x branches
- is caused by
TRUNK-4395 Add missing foreign key constraint on order_type.parent column