Affects Version/s: 1.8
Fix Version/s: 1.8
Component/s: Database activity module
I'm performing an upgrade on my Moodle install to today's beta build of 1.8. I am receiving this error during the upgrade script:
We failed to create an index on the columns "mnethostid" and "username" in your user table.
This can occur when you have duplicate usernames in your user table.
Your upgrade should still complete successfully. Click on the link above, and instructions on fixing this problem will appear in a new window. You can attend to that at the end of the upgrade.
I went to the link, ran this code on my mdl_user table:
count(username) AS instances
group by username
having (count(username) > 1);
It returned an empty set (zero rows). I checked again, and I have no duplicate usernames.
After the Moodle upgrade, I ran the suggested code:
CREATE UNIQUE INDEX user_mneuse_uix ON mdl_user (mnethostid, username);
And it executed successfully.
Yesterday's build of 1.8 beta did not have this issue.