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

The order_type table should be modified and not replaced with a new one

    Details

      Description

      In liquibase-update-to-latest.xml file, there are 2 changesets one drops the existing order_type table and the other adds a new one, there is also 2 changesets that modify the orders table by dropping the existing order_type_id column from orders and adding a new one. Note there is also changesets before that drop and add foreign key constraints where applicable, these also need to be removed where necessary.

      We need to keep the changeset that inserts an order_type for test order since it only inserts it if it doesn't exist but we need to remove the one the inserts one for drug orders because it comes as core data with a predifined order_type_id and uuid.
      Below are the changeset ids that are involved: (most if not all of them need to be removed)

      201403011303-TRUNK-4198_1, 201403011303-TRUNK-4198_2, 201403041701, 201403041702, 201403041703, 201403052242-TRUNK-4286,  201403070131-TRUNK-4286, 201403111039-TRUNK-4287-1, 201403111039-TRUNK-4287-2, 201403111039-TRUNK-4287-3, 201403111039-TRUNK-4287-4 
      

      TODOs

      • We need to revisit this so that instead of dropping the old order_type table and adding a new one, we instead just have to add the new columns java_class_name and parent to the existing order_type table following the scenarios below:
        • If the order_type table already has these 2 columns, we assume the admin knows what they are doing i.e they updated the order_type table by adding the new columns and set the valid column values so we do nothing.
        • If the 2 columns don't exist and the table contains exactly one row i.e the drug order row then add them and set the java_class_name column of the row to org.openmrs.DrugOrder see the drug order type uuid in liquibase-core-data.xml file, you will need to use the uuid to check if the row exists.
        • If none of the above conditions is satisfied, halt the upgrade asking the user to first update their order_type table table before proceeding following the 1.10 upgrade documentation/release notes.
      • You will need to add unit tests to Database1_9_7UpgradeTest to test the update scripts work as expected as described in the scenarios above.
      • Update CreateDiscontinueOrders.java to set the order_type_id of the new DC orders(should be the same as the one for the previous order)

        Attachments

          Activity

            People

            • Assignee:
              wyclif Wyclif Luyima
              Reporter:
              wyclif Wyclif Luyima
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Time Spent - 4 hours, 20 minutes Remaining Estimate - 3 hours, 40 minutes
                3h 40m
                Logged:
                Time Spent - 4 hours, 20 minutes Remaining Estimate - 3 hours, 40 minutes
                4h 20m