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

Upgrade to 2.x fails if a role called "Manager" exists

    Details

    • Database:
      Any
    • Testing Instructions:
      Hide

      Create a role with the name "Manager" in Moodle 1.9.
      Attempt to upgrade to Moodle 2.x.
      During the System section of the upgrade script, it will crash with a database error due to the non-unique value.

      Repeat the above with "manager" in short name.

      Show
      Create a role with the name "Manager" in Moodle 1.9. Attempt to upgrade to Moodle 2.x. During the System section of the upgrade script, it will crash with a database error due to the non-unique value. Repeat the above with "manager" in short name.
    • Workaround:
      Hide

      If you manually rename the Manager role that you have created to something else, the upgrade will work. However, there's currently nothing to tell you to do this.

      Show
      If you manually rename the Manager role that you have created to something else, the upgrade will work. However, there's currently nothing to tell you to do this.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w28_MDL-28253_m22_managerupgrade

      Description

      If you have created a role in Moodle 1.9 called "Manager", the upgrade to 2.x will fail as it will try and create a new role called "Manager", and the name field of the roles table must be unique.

      2 possible solutions would be:

      1. Leave the current "Manager" role in place and use it for 2.x's purposes (if that wouldn't cause problems), or
      2. Check for the existence of the "Manager" role at the start of the upgrade script, and tell the user they must rename it before the upgrade can continue.

      This issue has been discussed before, but not completely solved. See related issues.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            salvetore Michael de Raadt added a comment -

            I think this has been resolved as reported in the linked duplicate issue. If I'm missing something, please let me know.

            Show
            salvetore Michael de Raadt added a comment - I think this has been resolved as reported in the linked duplicate issue. If I'm missing something, please let me know.
            Hide
            marxjohnson Mark Johnson added a comment -

            Michael,
            MDL-24520 Is a very similar problem that was solved, but related to the shortname field of the roles table, while this relates to the name field.
            MDL-25807 Is the same problem, which was marked as fixed after someone confirmed that manually editing the name of the Manager role works around the problem. However, the problem still occurs, causing the 2.x upgrade process to crash halfway through and there's no warning before the process starts to let you know you can avoid the problem in this way.

            Cheers
            Mark

            Show
            marxjohnson Mark Johnson added a comment - Michael, MDL-24520 Is a very similar problem that was solved, but related to the shortname field of the roles table, while this relates to the name field. MDL-25807 Is the same problem, which was marked as fixed after someone confirmed that manually editing the name of the Manager role works around the problem. However, the problem still occurs, causing the 2.x upgrade process to crash halfway through and there's no warning before the process starts to let you know you can avoid the problem in this way. Cheers Mark
            Hide
            salvetore Michael de Raadt added a comment -

            Re-opening this as there does appear to be a difference here. Thanks, Mark, for elaborating that.

            Show
            salvetore Michael de Raadt added a comment - Re-opening this as there does appear to be a difference here. Thanks, Mark, for elaborating that.
            Hide
            salvetore Michael de Raadt added a comment -

            Hi, Petr.

            Could you please extend your solution to the linked problem so that it covers the name field as well as the short-name field?

            Michael;

            Show
            salvetore Michael de Raadt added a comment - Hi, Petr. Could you please extend your solution to the linked problem so that it covers the name field as well as the short-name field? Michael;
            Hide
            skodak Petr Skoda added a comment -

            I do not know what is the state of 1.9 upgrades in 2.1, is it even supported?

            Show
            skodak Petr Skoda added a comment - I do not know what is the state of 1.9 upgrades in 2.1, is it even supported?
            Hide
            marxjohnson Mark Johnson added a comment -

            According to http://docs.moodle.org/dev/Upgrading_to_Moodle_2.1, "When upgrading to Moodle 2.1, you must have Moodle 1.9 or later".

            Show
            marxjohnson Mark Johnson added a comment - According to http://docs.moodle.org/dev/Upgrading_to_Moodle_2.1 , "When upgrading to Moodle 2.1, you must have Moodle 1.9 or later".
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks Petr - this has been integrated now

            Show
            samhemelryk Sam Hemelryk added a comment - Thanks Petr - this has been integrated now
            Hide
            mudrd8mz David Mudrak added a comment -

            Test passed. The role Manager2 created during the upgrade as expected.

            Show
            mudrd8mz David Mudrak added a comment - Test passed. The role Manager2 created during the upgrade as expected.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  1/Aug/11