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

mod_assign upgrade fails when upgrading from 2.3.6 to 2.5beta+ (Build: 20130426)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.5
    • Fix Version/s: None
    • Component/s: Assignment
    • Labels:
    • Database:
      Any
    • Testing Instructions:
      Hide

      Create an Assignment module to submit files.
      Submit a file as student
      Admin reset the submission back to draft.
      Re-submit the file as student.

      Run the Assign upgrade tool.

      3 entries should created under the same submission and upgrade will fail.

      Show
      Create an Assignment module to submit files. Submit a file as student Admin reset the submission back to draft. Re-submit the file as student. Run the Assign upgrade tool. 3 entries should created under the same submission and upgrade will fail.
    • Workaround:
      Hide

      Run this SQL to remove older duplicated records.

      DELETE FROM mdl_assign_submission as1
      WHERE EXISTS
      (SELECT 1 FROM mdl_assign_submission as2
      WHERE as1.assignment=as2.assignment
      AND as1.userid=as2.userid
      AND as1.groupid=as2.groupid
      AND as1.attemptnumber=as2.attemptnumber
      AND as2.timemodified > as1.timemodified);

      Show
      Run this SQL to remove older duplicated records. DELETE FROM mdl_assign_submission as1 WHERE EXISTS (SELECT 1 FROM mdl_assign_submission as2 WHERE as1.assignment=as2.assignment AND as1.userid=as2.userid AND as1.groupid=as2.groupid AND as1.attemptnumber=as2.attemptnumber AND as2.timemodified > as1.timemodified);
    • Affected Branches:
      MOODLE_25_STABLE

      Description

      I'm upgrading my local 2.3.6 instance to 2.5beta+ (Build: 20130426) and found that if you have had your assignment reverted to draft the index will fail to be created.

      Debug info: ERROR: could not create unique index "mdl_assisubm_assusegroatt_uix"
      DETAIL: Key (assignment, userid, groupid, attemptnumber)=(3, 0, 0, 0) is duplicated.
      CREATE UNIQUE INDEX mdl_assisubm_assusegroatt_uix ON mdl_assign_submission (assignment, userid, groupid, attemptnumber)

      id | assignment | userid | timecreated | timemodified | status | groupid | attemptnumber
      ----------------------------------------------------------+--------------
      7 | 3 | 0 | 1358236254 | 1358836919 | submitted | 0 | 0
      8 | 3 | 0 | 1358236180 | 1358239988 | submitted | 0 | 0
      9 | 3 | 0 | 1358236108 | 1358835811 | submitted | 0 | 0
      10 | 3 | 0 | 1358236037 | 1358236037 | draft | 0 | 0
      11 | 3 | 0 | 1358235950 | 1358235956 | submitted | 0 | 0
      12 | 3 | 0 | 1358235778 | 1358235787 | submitted | 0 | 0

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: