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

Relation mdl_course_modules_viewed not exist error since upgrade has not been run

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 4.1
    • 4.1
    • General
    • MOODLE_401_STABLE
    • MOODLE_401_STABLE
    • MDL-76033-master
    • Hide
      1. Install a fresh Moodle site using Moodle 3.11
      2. Create a course using default settings
      3. View the course page and copy the url to clipboard so you can go back there
      4. Upgrade the code to Moodle 4.0 (just code - don't run upgrade script)
      5. Visit the course page directly

      EXPECTED: You should not see a coding exception error at this point, but should be redirect to the upgrade process as normal.

      BEFORE FIX: A coding exception appears.

      Same instructions for my/indexsys.php page

      Show
      Install a fresh Moodle site using Moodle 3.11 Create a course using default settings View the course page and copy the url to clipboard so you can go back there Upgrade the code to Moodle 4.0 (just code - don't run upgrade script) Visit the course page directly EXPECTED : You should not see a coding exception error at this point, but should be redirect to the upgrade process as normal. BEFORE FIX : A coding exception appears. Same instructions for my/indexsys.php page

    Description

      After landing MDL-58266 if you update Moodle to use latest code and access course page without running upgrade you will get

      Debug info: ERROR: relation "mdl_course_modules_viewed" does not exist
      LINE 6: ... LEFT JOIN mdl_course...
      ^
      SELECT cm.id AS cmid, cmc.*,
      CASE WHEN cmv.id IS NULL THEN 0 ELSE 1 END AS viewed
      FROM mdl_course_modules cm
      LEFT JOIN mdl_course_modules_completion cmc
      ON cmc.coursemoduleid = cm.id AND cmc.userid = $1
      LEFT JOIN mdl_course_modules_viewed cmv
      ON cmv.coursemoduleid = cm.id AND cmv.userid = $2
      INNER JOIN mdl_modules m ON m.id = cm.module
      WHERE m.visible = 1 AND cm.course = $3
      [array (
      0 => 2,
      1 => 2,
      2 => '13',
      )]
      Error code: dmlreadexception
      

      We should force site upgrade to create a table

      Attachments

        Issue Links

          Activity

            People

              ilyatregubov Ilya Tregubov
              ilyatregubov Ilya Tregubov
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Victor Déniz Falcón Victor Déniz Falcón
              Angelia Dela Cruz Angelia Dela Cruz
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                28/Nov/22

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 25 minutes
                  1h 25m