Hi, the following is the procedure I have used to upgrade my 4.6 buddylist table to the 4.7 buddylist structure without losing any data. It's fairly simple, and I admit I haven't tested it thoroughly. Someone who is more familiar than I with the 4.7 buddlylist table structure should be able to look at this and see immediately if the end result achieved has any loose ends or not.

The following assumes you have not yet enabled buddylist again after upgrading from 4.6 to 4.7. It essentially creates one buddy group called "Friends" for each user that had buddies to begin with, and places all their buddies in that group.

1. Make a copy of your 4.6 buddlist table, and delete the original.
- I used the following 2 SQL commands to do this:
CREATE TABLE `buddylist-orig` (
`uid` int( 10 ) unsigned NOT NULL default '0',
`buddy` int( 10 ) unsigned NOT NULL default '0',
`timestamp` int( 11 ) NOT NULL default '0',
`received` tinyint( 1 ) NOT NULL default '0',
PRIMARY KEY ( `uid` , `buddy` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 COLLATE = utf8_spanish_ci;

INSERT INTO `buddylist-orig`
SELECT *
FROM `buddylist` ;

2. Upload the 4.7 buddylist module (if you haven't already), navigate to "admin/modules" and enable it. This will create the three tables used by version 4.7 of Buddylist: buddylist, buddylist_buddy_group, buddylist_groups.

3. Run the following 3 sql commands against your database:

INSERT INTO `buddylist`
SELECT *
FROM `YAQ_Test`.`buddylist-orig` ;

INSERT INTO buddylist_buddy_group
SELECT uid, buddy, 1 AS 'label_id'
FROM buddylist;

INSERT INTO buddylist_groups
SELECT DISTINCT uid, 1 AS 'label_id', 'Friends' AS 'label', 0 AS 'visible'
FROM buddylist;

4. When you are satisfied everything is working and properly upgraded, you can use the following SQL command to delete the copy of your 4.6 buddylist table.

DROP TABLE `buddylist-orig`;

This assumes that you know how to run SQL commands using either the console or phpmyadmin. Ideally, these steps could be built into an automated upgrade file for this module, but since I don't know how to do that I figured I'd at least post this semi-manual procedure in case it helps someone.

This has not been heavily tested, so use at your own risk!

Best,

Steve

Comments

robertdouglass’s picture

Great thanks! Hopefully, I or someone else will be able to find time to code this as an update function in the buddylist.install file. Thank you for sharing your work with us.

Gary Feldman’s picture

Is it really necessary to delete and recreate the buddlist table? The schema is the same between the latest 4.6 and 4.7, so copying it back and forth shouldn't be changing anything.

robertdouglass’s picture

Gary: in fact, the db schema went from one table to three, so something like the procedure mentioned above is needed. I haven't tested it and would appreciate other peoples' experience with the upgrade.

simon georges’s picture

Status: Needs work » Closed (won't fix)

This version of Buddylist is not supported anymore. The issue is closed for this reason.

Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.

simon georges’s picture

duplicate comment.