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

Orders.orderer column cannot be set to NOT NULL until after user to provider migration occurs

    XMLWordPrintable

Details

    Description

      When updating to 1.10.x, the orders.orderer column is changed to foreign key to the provider table, not the user table. Also, the column is changed to be NOT NULL.

      However the liquibase changeset to add the constraint to make orders NOT NULL comes before the changeset that migrates users to providers (and which make sure all NULL orderer entries are set to map the Unknown Provider).

      So, an upgrade to 1.10 would fail for all implementations that have values of NULL in the orderer column of the order table.

      The fix to this would be move to the changeset that adds the constraint ("201403011348") so that it is AFTER the changeset that migrates users to providers ("201402051638-TRUNK-4202").

      (Interesting, from the dates in the changeset ids above, it looks like the changeset that adds the NOT NULL constraint was originally after the migration changeset).

      I think this can simply be fixed by moving the NOT NULL changeset later in the liquibase migration file without impacting any existing users.

      djazayeri wyclif, thoughts?

      Gliffy Diagrams

        Attachments

          Activity

            People

              mogoodrich Mark Goodrich
              mogoodrich Mark Goodrich
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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