Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-30515

Check for non-unique values before adding unique indexes during Moodle 2.x upgrade

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.1
    • Fix Version/s: 2.2.5
    • Component/s: Database SQL/XMLDB
    • Environment:
      Probably shouldn't matter but I'm testing on Debian GNU/Linux with MySQL 5.1 and PostgreSQL 9.1
    • Database:
      Any
    • Testing Instructions:
      Hide

      Steps

      1. setup a new Moodle 1.9 site or use an existing one
      2. forcibly insert duplicate records in the mdl_grade_letters table (duplicate values being the same value for contextid, lowerboundary, and letter in two or more records)
      3. perform an upgrade to Moodle 2.2 with the patch applied

      Expected outcome

      The upgrade should complete without any problems.

      Problem outcome

      The upgrade fails when trying to add the unique index on the mdl_grade_letters table.

      Show
      Steps setup a new Moodle 1.9 site or use an existing one forcibly insert duplicate records in the mdl_grade_letters table (duplicate values being the same value for contextid , lowerboundary , and letter in two or more records) perform an upgrade to Moodle 2.2 with the patch applied Expected outcome The upgrade should complete without any problems. Problem outcome The upgrade fails when trying to add the unique index on the mdl_grade_letters table.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull from Repository:

      Description

      During an upgrade from Moodle 1.9 to Moodle 2.x a unique index is added to the mdl_grade_letters table. I have seen more than one case where this table contains duplicate records that prevent this index from being added and thus halt the upgrade, preventing it from continuing until the duplicates are dealt with.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dmonllao David Monllaó
              Reporter:
              jfilip Justin Filip
              Peer reviewer:
              Ankit Agarwal
              Integrator:
              Sam Hemelryk
              Tester:
              Michael de Raadt
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Sep/12