Quiz DB Error during Moodle Upgrade from 2.8 to 2.9

Re: Quiz DB Error during Moodle Upgrade from 2.8 to 2.9

by Dean Turner -
Number of replies: 2

Well I've solved this. You only need to delete every row in mdl_quiz_section.

In reply to Dean Turner

Re: Quiz DB Error during Moodle Upgrade from 2.8 to 2.9

by John Feagans -

I get an error on this upgrade as well from 2.8 to 2.9.  There are no rows and the table is not present in 2.8. The table exists but the upgrade gets the error:

Debug info: Unknown column 'shufflequestions' in 'field list'

INSERT INTO mood_quiz_sections
(quizid, firstslot, heading, shufflequestions)
SELECT id, 1, ?, shufflequestions
FROM mood_quiz

[array (
0 => '',
)]
Error code: dmlwriteexception
Stack trace:
  • line 446 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 974 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 873 of /mod/quiz/db/upgrade.php: call to mysqli_native_moodle_database->execute()
  • line 706 of /lib/upgradelib.php: call to xmldb_quiz_upgrade()
  • line 424 of /lib/upgradelib.php: call to upgrade_plugins_modules()
  • line 1630 of /lib/upgradelib.php: call to upgrade_plugins()
  • line 433 of /admin/index.php: call to upgrade_noncore()
In reply to John Feagans

Re: Quiz DB Error during Moodle Upgrade from 2.8 to 2.9

by John Feagans -

To get my upgrade completed I took the drastic step of commenting out the offending code.  Please advise how I need to fix the database since I eliminated the creation of these rows.

From upgrade.php mod/quiz/db

    if ($oldversion < 2015032301) {


        // Create a section for each quiz.

/* *************************************************************************

        $DB->execute("

                INSERT INTO {quiz_sections}

                            (quizid, firstslot, heading, shufflequestions)

                     SELECT  id,     1,         ?,       shufflequestions

                       FROM {quiz}

                ", array(''));

***************************************************************************/

        // Quiz savepoint reached.

        upgrade_mod_savepoint(true, 2015032301, 'quiz');