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

Restore code needs to be robust to unique key violations in old data

XMLWordPrintable

    • MOODLE_27_STABLE, MOODLE_28_STABLE
    • MOODLE_27_STABLE, MOODLE_28_STABLE
    • Hide

      In place of steps 1-7, you could use the file attache by Eloy, and shower him with thanks.

      1. Make a Moodle 2.4 install
      2. Create a course
      3. Add a quiz
      4. Add one each of a matching, multi-choice and short-answer question.
      5. Go into the database, and find the tables with names like (question|qtype)_(match|numerical|shortanswer)(_options)?
      6. In each one, duplicate the row you find there, so only the id column is different.
      7. Backup the course.
      8. For each branch where you need to test this fix (2.7, 2.8, master), restore that backup.
      9. Verify the restore completes with no errors.
      10. Go to the question bank of the restored course, and click on the edit icon for each question to verify that the options for each question have not been lost during the backup/restore.
        # Have a well-earned beer, or other beverage of your choice.

      To test the random short-answer match part of the change, you would need to install 2.0 or earlier, and I am guessing you don't want to do that. It is probably OK to just review the code and see that the change is the same as in the other qtypes.

      Show
      In place of steps 1-7, you could use the file attache by Eloy, and shower him with thanks. Make a Moodle 2.4 install Create a course Add a quiz Add one each of a matching, multi-choice and short-answer question. Go into the database, and find the tables with names like (question|qtype)_(match|numerical|shortanswer)(_options)? In each one, duplicate the row you find there, so only the id column is different. Backup the course. For each branch where you need to test this fix (2.7, 2.8, master), restore that backup. Verify the restore completes with no errors. Go to the question bank of the restored course, and click on the edit icon for each question to verify that the options for each question have not been lost during the backup/restore. # Have a well-earned beer, or other beverage of your choice. To test the random short-answer match part of the change, you would need to install 2.0 or earlier, and I am guessing you don't want to do that. It is probably OK to just review the code and see that the change is the same as in the other qtypes.

      This is similar to MDL-40370 or MDL-41093, but for restore, not upgrade.

      Someone in the quiz forum just hit this: https://moodle.org/mod/forum/discuss.php?d=280646#unread

            timhunt Tim Hunt
            timhunt Tim Hunt
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Andrew Lyons Andrew Lyons
            Mark Nelson Mark Nelson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.