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

Incorrectly defined unique key in auth/lti/upgrade.php

    XMLWordPrintable

Details

    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • MDL-74138-master
    • Hide

      Note: You'll need to be able to run and upgrade sites on both mssql, oracle and either maria or pgsql to test this one properly. You'll need a clone of integration to do this. An easy way to do this is via https://github.com/moodlehq/moodle-docker.

      Oracle

      1. Requirement: This issue testing requires MDL-74143 to be already integrated.
      2. Create a site running MOODLE_39_STABLE
      3. Install
      4. Checkout integration master
      5. Upgrade
      6. Verify upgrade runs without errors (if you're doing this via web browser, you may need to refresh the page a few times as it's super slow)

      Mssql

      1. Create a site running MOODLE_39_STABLE
      2. Install
      3. Checkout integration master
      4. Upgrade
      5. Verify upgrade runs without errors

      Pgsql/Maria

      1. Create a site running MOODLE_39_STABLE
      2. Install
      3. Checkout 01eb6d2e9b45 (this doesn't include the patch yet)
      4. Run the upgrade and verify it succeeds without errors
      5. Now checkout integration master
      6. Upgrade
      7. Verify upgrade runs without errors

      Missing index test

      1. Using postgres, create a site running MOODLE_39_STABLE
      2. Install
      3. Checkout 01eb6d2e9b45 (this doesn't include the patch yet)
      4. Run the upgrade and verify it succeeds without errors
      5. Now manually edit the table via the cli, dropping the index (simulating a case where the index wasn't created but the upgrade did run)

        psql DATABASENAME
        \d PREFIX_auth_lti_linked_login <-- get the index name via the indexes list produced by this command.
        drop index mdl_authltilinklogi_useiss_uix
        

      6. Now checkout integration master
      7. Upgrade
      8. Verify upgrade runs without errors
      Show
      Note: You'll need to be able to run and upgrade sites on both mssql, oracle and either maria or pgsql to test this one properly. You'll need a clone of integration to do this. An easy way to do this is via https://github.com/moodlehq/moodle-docker . Oracle Requirement: This issue testing requires MDL-74143 to be already integrated. Create a site running MOODLE_39_STABLE Install Checkout integration master Upgrade Verify upgrade runs without errors (if you're doing this via web browser, you may need to refresh the page a few times as it's super slow) Mssql Create a site running MOODLE_39_STABLE Install Checkout integration master Upgrade Verify upgrade runs without errors Pgsql/Maria Create a site running MOODLE_39_STABLE Install Checkout 01eb6d2e9b45 (this doesn't include the patch yet) Run the upgrade and verify it succeeds without errors Now checkout integration master Upgrade Verify upgrade runs without errors Missing index test Using postgres, create a site running MOODLE_39_STABLE Install Checkout 01eb6d2e9b45 (this doesn't include the patch yet) Run the upgrade and verify it succeeds without errors Now manually edit the table via the cli, dropping the index (simulating a case where the index wasn't created but the upgrade did run) psql DATABASENAME \d PREFIX_auth_lti_linked_login <-- get the index name via the indexes list produced by this command. drop index mdl_authltilinklogi_useiss_uix Now checkout integration master Upgrade Verify upgrade runs without errors
    • 1
    • QA time

    Description

      Reported here: https://moodle.org/mod/forum/discuss.php?d=432562

      Line 55:

       $table->add_key('unique_key', XMLDB_KEY_UNIQUE, ['userid, issuer256, sub256']);

      Shouldn't quote all fields in one string, but rather should quote the individual fields. This presents as an upgrade error on sqlsrv (and perhaps other dbs).

      I.e. should be doing this:

      $table->add_key('unique_key', XMLDB_KEY_UNIQUE, ['userid', 'issuer256', 'sub256']); 

      Postgres seems to work somehow - as if that code path corrects the index or something.
      Mariadb - works and index created ok - same as pgsql.
      Mysql - works and index created ok - same as pgsql.
      Oracle - fails upgrade like mssql does.

      Attachments

        1. mssql frontend.png
          mssql frontend.png
          28 kB
        2. mssql upgrade.png
          mssql upgrade.png
          41 kB
        3. oracle frontend.png
          oracle frontend.png
          40 kB
        4. oracle upgrade.png
          oracle upgrade.png
          74 kB
        5. postgres without patch 1.png
          postgres without patch 1.png
          98 kB
        6. postgres without patch 2.png
          postgres without patch 2.png
          131 kB
        7. postgres with patch 1.png
          postgres with patch 1.png
          71 kB
        8. postgres with patch 2.png
          postgres with patch 2.png
          65 kB

        Issue Links

          Activity

            People

              jaked Jake Dallimore
              jaked Jake Dallimore
              Mihail Geshoski Mihail Geshoski
              Jun Pataleta Jun Pataleta
              Angelia Dela Cruz Angelia Dela Cruz
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                19/Apr/22

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 5 hours, 5 minutes
                  5h 5m