Hi
I tried to upgrade the module from 5.x-2.x.dev to 6.x-1.0-rc2 and got the following error:
# user warning: Table 'live_user_relationships' already exists query: CREATE TABLE live_user_relationships ( `rid` INT NOT NULL auto_increment, `requester_id` INT unsigned NOT NULL DEFAULT 0, `requestee_id` INT unsigned NOT NULL DEFAULT 0, `rtid` INT unsigned NOT NULL DEFAULT 0, `approved` TINYINT unsigned NOT NULL DEFAULT 0, `created_at` INT unsigned NOT NULL DEFAULT 0, `updated_at` INT unsigned NOT NULL DEFAULT 0, `flags` INT unsigned NOT NULL DEFAULT 0, PRIMARY KEY (requester_id, requestee_id, rtid), INDEX requester_id (requester_id), INDEX requestee_id (requestee_id), INDEX rtid (rtid), INDEX rid (rid) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /opt/lampp/htdocs/drupal/includes/database.inc on line 517.
# user warning: Table 'live_user_relationship_types' already exists query: CREATE TABLE live_user_relationship_types ( `rtid` INT unsigned NOT NULL auto_increment, `name` VARCHAR(255) NOT NULL DEFAULT '', `plural_name` VARCHAR(255) NOT NULL DEFAULT '', `is_oneway` TINYINT unsigned NOT NULL DEFAULT 0, `requires_approval` TINYINT unsigned NOT NULL DEFAULT 0, `expires_val` INT unsigned NOT NULL DEFAULT 0, PRIMARY KEY (rtid), UNIQUE KEY name (name) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /opt/lampp/htdocs/drupal/includes/database.inc on line 517.
It looks to me as if the module does not create the tables because they already exist - which is correct so far. However, if I run update.php no database changes are conducted. Hence, the module runs even under 6.x with the old 5.x table structure - is this correct? Is there really no table or table structure change from 5.x to 6.x?
Thanks
carsonh
Comments
Comment #1
alex.k commentedThere have been important changes to the tables, but a standard upgrade won't catch that, unfortunately. I've committed a fix for this to the 5.x branch. The short story is, you'll need to enable the UR Migration assistant module on the 5.x install. The module doesn't do anything, just serves to make the updates run through.
Long story, in 5.x. the module is called user_relationships, but in 6.x it's been split into user_relationships_api and user_relationships_ui. So after the upgrade there is no way for Drupal to know that existing tables belong to a different module now. The added blank module makes it look like it existed under 5.x, that's all. Then hook_update() run correctly during upgrade to 6.x.
Comment #2
alex.k commentedThere is also a related commit to UR-Blocks 6.x, which makes the upgrade more straightforward.
Comment #3
carsonh commentedThanks very much for your explanation. Unfortunately, it's no real option for me to roll back to the 5.x installation because the rest of the installation and modules and most of the database is already 6.x... However, the funny thing is that it seems to work so far, even with the broken update.
Comment #4
alex.k commentedYou might run into problems in the future, as the rid column has changed to an autoincrement type, and the code is relying on that now. You can make the database catch up to current schema by manually updating the schema version:
UPDATE `system` SET `schema_version` = '0' WHERE `system`.`filename` = 'sites/all/modules/user_relationships/user_relationships_api/user_relationships_api.module' LIMIT 1 ;
you might need to tweak the 'sites/all/modules' portion. After this running update.php should bring it up to date. Just make a backup of the database beforehand.
Comment #6
alex.k commentedRelevant commits for 5->6 upgrade are:
6.x: http://drupal.org/cvs?commit=262454
5.x: http://drupal.org/cvs?commit=262488