Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-4693

Liquibase change set 201406152043 introduces an invalid foreign key

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Must
    • Resolution: Fixed
    • Affects Version/s: Platform 1.10.0, Platform 1.10.1, Platform 1.11.0, Platform 1.11.1
    • Component/s: Order Entry
    • Labels:
      None
    • Complexity:
      Low

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mseaton Mike Seaton
                Reporter:
                mseaton Mike Seaton
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 2 hours
                  2h
                  Remaining:
                  Time Spent - 1 hour Remaining Estimate - 1 hour
                  1h
                  Logged:
                  Time Spent - 1 hour Remaining Estimate - 1 hour
                  1h