No groups after upgrade 1.8.2 > 1.9.2

No groups after upgrade 1.8.2 > 1.9.2

by Daniel Buza -
Number of replies: 10

Hi all

I upgraded our moodle from 1.8.2 > 1.9.2 and I have realised that I have lost all my groups. Upon further test of the install it stated that there is no "courseid" field in mdl_groups. I have since added the field but the groups are not showing up. All the groups are still in mdl_groups in the database. I would be very gratefull for your help.

Average of ratings: -
In reply to Daniel Buza

Re: No groups after upgrade 1.8.2 to 1.9.2

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Daniel,

I had a look in the tracker and came across a serious bug relating to groups and upgrading - MDL-15580. Please help us fix the bug by providing information about your own set-up. (You will need to create a tracker account and login in order to add a comment.)
In reply to Helen Foster

Re: No groups after upgrade 1.8.2 to 1.9.2

by Brian Lockwood -
Well I am in a similar process and two database issues may have something to do with this.

In the table mdl_groups I get a complaint that their is no password field and then when i provide one, I get a complaint that when the name of enromentkey is being changed to password, that there is a duplicate key.

Leaving this upgrade for now as it is dinner time!!
In reply to Daniel Buza

Re: No groups after upgrade 1.8.2 > 1.9.2

by Richard Enison -
DB,

When I read your post I thought it seemed familiar. I knew I had seen this issue, or something very similar, before. It was probably the tracker issue HF mentions, or a reference to it, that I was recalling.

So while I concur with her about adding your comment to the tracker issue, I also have a question about your installation that might be helpful: when you added the courseid field back to mdl_groups, did you also add the contents of that field that it (presumably) had in 1.8.2? You do have a backup of it that you can consult, right? (As I keep saying, always, always, always backup before upgrading or making a major change to ANYTHING on a computer!) If so, it should be a simple process of copying the column from the old database to the new one.

RLE
In reply to Richard Enison

Re: No groups after upgrade 1.8.2 > 1.9.2

by Daniel Buza -

RLE,

I thought that would do thr trick when I was upgrading except for the fact that there was no "courseid" field in the 1.8.2 database sad I dont know if this field was added during a later verion of 1.8.X or if my predicesor may have done a faulty install, but it did work fine in 1.8.2 without that field.

Also thank you for the details on the bud, I will sign up and get some info over asap.

DB

In reply to Daniel Buza

Re: No groups after upgrade 1.8.2 > 1.9.2

by trudy k -

I had same issues you mentioned with groups and missing id etc. in July when I tried to upgrade from 1.6.6 via 1.8.4. (i also tried via 17x without success) to 1.9.2.

directly upgrading from 1.6.6. to 1.9.2. did the trick for me.

Only now my the site is very slow and seems  to have problem i.e. with deleting groups in a course. (takes about 3 minutes to delete a group, or underlying courses, in a course!)

In reply to trudy k

Re: No groups after upgrade 1.8.2 > 1.9.2

by Brian Lockwood -
The problem with doing upgrades that miss versions is that you can easily miss out thing that won't stop things working but will effect efficiency.

From your description it could be as simple as a missing index. This would mean that a routine activity would work but the lack of index would mean that mysql would use more processor for each of the guilty transactions.

This would be an index that would be created in a 1.7>1.8 upgrade and then assumed in a 1.8>1.9 upgrade.

Upgrades cretainly create and remake some indices as I have seen this happen.
In reply to Brian Lockwood

Re: No groups after upgrade 1.8.2 > 1.9.2

by Brian Lockwood -
A Vanilla install of version 1.9 does have a course_id field in mdl_groups. So adding it in would seem reasonable if it is not there after an upgrade. Also, it is an indexed field, so if you have not indexed when you added it, and you use groups a lot then you will suffer a significant performance hit.
In reply to Brian Lockwood

No groups. A workaround after upgrades to 1.9.2

by Brian Lockwood -
In the following I have used attribute/entity instead of field/table.

OK, here is a work-around that I have used today to get groups working on a 1.7>1.8>1,9 upgrade.

You are going to be working with the database. None of this is being done inside moodle. Tyhe work is nothing to do with moodle. It is just sql. You either need phpmyadmin, webmin, mysqladmin or just enough familiarity with command line to do some fairly basic stuff with mysql. If you work on more than one machine then make sure you are working with the same version of mysql. (Just to play safe).

First of all, If you get the error concerning no password file when doing an upgrade from 1.8>1.9 then change name of the 'enrolmentkey' attribute name in the 'mdl_groups' entity to 'password 'and then try the upgrade again. The 1.9 upgrade script appears to expect the attribute 'password' to be found in mdl_groups in order to change it to 'enrolmentkey'. (I think this may be an issue associated with the upgrade from 1.7>1,8 which many people do not do as 1.7 ended up being a bit of a backwater.).

The new mdl_groups entity has no attribute called courseid. I think this is a problem because a vanilla 1.9 install has the 'courseid' attribute. This leads me to think that an upgraded one should have this as well.

If you just add a courseid attribute to the mdl_groups table then you will not have a good solution because it is an indexed field and it does need to be. If you do not index the attribute then you will suffer performance issues. (Also in the back of my mind I think that with indices it might matter that your courseid is not going to be the second attribute in the entity.).

You are now in the following situation.
1) You have a working upgraded moodle except that your groups are missing (in my case 1.9).
2) You have a backup of your original database from the older moodle where groups did work. (In my case 1.7).

0) Do an sqlbackup of your whole 1.9 database. (Just in case! Really do this. NOT doing this is just silly.).
1) Get the old sql backup of just the original (pre-upgrade database) mdl_groups entity on its own. (In my case version 1.7). Load this original database into mysql as a different database (Don't overwrite your new database!) and then do an sqlbackup of just the mdl_groups entity. Alternatively you can extract the relevant stuff from your whole sql backup of your original database. (You will need a really good text editor to manage this latter technique.)
2) Import just the mdl_groups entity into a new empty database. This is just to do some work.
3) Working in this new database with just the mdl_groups entity. Delete the attributes 'lang' and 'theme'. (If you have a decent text editor then you may be slick enough to do it on the sql backup file but you will have to do some pretty fancy regexp work to kick the attribute values out from the file).
4) Change the type on 'id' and 'courseid' to bigint(10) from int.
5) Do an sqlbackup of the new mdl_groups table which you now have.
6) Execute the sql backup onto your new moodle. In other words, open the 1.9 database that you have in your upgraded moodle and execute the sql backup of the adapted mdl_groups entity on top of it. This will replace your mdl_groups table with your edited version.
7) You can now delete the temporary database(s) you created during this process.

Groups should now work. They did for me. If the whole thing goes belly up then just restore your database from the backup you did at point 0 above.


In reply to Brian Lockwood

Rest of the workaround after upgrades to 1.9.2

by Brian Lockwood -
You need to do this stuff as well as the previous message. There is another table called mdl_groups_members. The process is similar to mdl_groups, the types are all bigint(10) and id is autoincrement. The other three have default values of zero.

Now do similar to above except you do not need to delete any fields and the table this time is mdl_groups_members.

If you have done anythig to your moodle after the upgrade concerning groups then this process will not work as you have contaminated the database.
In reply to Daniel Buza

Re: No groups after upgrade 1.8.2 > 1.9.2

by soumya khatri -
can u please tell me frm where can i get the upgradation (from 1.8 to 1.9) file?

if possible cam u jst mail me at soumya_khatri@worldkonex.com