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

Upgrade fails to 2.1+ running MySQL 5.7+ with saved cohorts

    XMLWordPrintable

Details

    Description

      There seems to be a bug in the liquibase-update-to-2.1.xml script, specifically in the way changeSets "201609171146-3" and  "201610242135-3" are implemented.

      Basically, the first changeSet adds a new column to an existing table (cohort_member.start_date) with a not-null constraint.

      The second changeset populates this column with a default value (from cohort.date_created).

      It would seem that if there is existing data in this table for which a default value needs to be applied, then the first change will fail (and this is what we are seeing in our test environments), as it is adding a not-null column that would inherently start with null values.

      This specifically seems to manifest in errors with MySQL 5.7+ in which the SQL Mode does not allow "0" for datetime.

      NOTE:  One way of solving this ticket is to remove the non-null constraint from this table altogether, as tickets TRUNK-5211 and TRUNK-5331 have made clear should never have been done in the first place.  burke / dkayiwa / jbyiringiro / tanderson  FYI

      Gliffy Diagrams

        Attachments

          1. screenshot-1.png
            screenshot-1.png
            52 kB
          2. screenshot-2.png
            screenshot-2.png
            39 kB

          Activity

            People

              navareth Bartłomiej Rasztabiga
              mseaton Mike Seaton
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: