Uploaded image for project: 'VPMS Web Application'
  1. OVPMS-2025

Duplicate reminder counts cause 1.9 to 2.0 migration to fail

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects versions: 2.0
    • Fix versions: 2.0
    • Components: Release
    • Labels:
      None
    • Sprint:

      Description

      If a 1.9 Reminder Type has duplicate reminder counts, dbtool --update fails with:

      Updating to 1.9.0.8 - OVPMS-1922 ... Migration of schema `openvpms-1_8` to version 1.9.0.8 - OVPMS-1922 failed! Please restore backups and roll back database and code!
      org.flywaydb.core.internal.dbsupport.FlywaySqlScriptException:
      Migration V1.9.0.8__OVPMS-1922.sql failed
      -----------------------------------------
      SQL State  : 23000
      Error Code : 1062
      Message    : Duplicate entry '1147-0' for key 'PRIMARY'
      Location   : org/openvpms/db/migration/1.9/V1.9.0.8__OVPMS-1922.sql 
      Line       : 109
      Statement  : INSERT INTO tmp_reminder_type_count (entity_id, reminder_count, overdue_interval, overdue_units)
        SELECT
          reminder_type.entity_id,
          reminder_count_count.value,
          reminder_count_interval.value,
          reminder_count_units.value units
        FROM entities reminder_type
          JOIN entity_links lreminder_count
            ON lreminder_count.source_id = reminder_type.entity_id
          JOIN entities reminder_count
            ON lreminder_count.target_id = reminder_count.entity_id
               AND reminder_count.arch_short_name = 'entity.reminderCount'
          JOIN entity_details reminder_count_count
            ON reminder_count_count.entity_id = reminder_count.entity_id
               AND reminder_count_count.name = 'count'
          JOIN entity_details reminder_count_interval
            ON reminder_count_interval.entity_id = reminder_count.entity_id
               AND reminder_count_interval.name = 'interval'
          JOIN entity_details reminder_count_units
            ON reminder_count_units.entity_id = reminder_count.entity_id
               AND reminder_count_units.name = 'units'
        WHERE reminder_type.arch_short_name = 'entity.reminderType'
      

        Attachments

          Activity

            People

            • Assignee:
              tanderson Tim Anderson
              Reporter:
              tanderson Tim Anderson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 3h
                3h

                  Who's Looking?