Index: user_relationships_api/user_relationships_api.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/user_relationships/user_relationships_api/Attic/user_relationships_api.install,v
retrieving revision 1.1.2.5
diff -b -u -p -r1.1.2.5 user_relationships_api.install
--- user_relationships_api/user_relationships_api.install	14 Oct 2008 09:14:03 -0000	1.1.2.5
+++ user_relationships_api/user_relationships_api.install	29 Jan 2009 14:29:55 -0000
@@ -1,15 +1,18 @@
 <?php
 // $Id: user_relationships_api.install,v 1.1.2.5 2008/10/14 09:14:03 alexk Exp $
 
-
 /**
  * @file
- * User Relationships Schema
+ * User Relationships API Module installation file.
+ */
+
+/**
+ * Implementation of hook_schema().
  */
 function user_relationships_api_schema() {
   $schema['user_relationships'] = array(
     'fields' => array(
-      'rid'           => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
+      'rid'           => array('type' => 'serial', 'not null' => TRUE),
       'requester_id'  => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
       'requestee_id'  => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
       'rtid'          => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
@@ -18,11 +21,11 @@ function user_relationships_api_schema()
       'updated_at'    => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
       'flags'         => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
     ),
+    'primary key' => array('rid'),
     'unique keys' => array(
       'relationship' => array('requester_id', 'requestee_id', 'rtid'),
     ),
     'indexes' => array(
-      'rid' => array('rid'),
       'requester_id' => array('requester_id'),
       'requestee_id' => array('requestee_id'),
       'rtid' => array('rtid'),
@@ -48,15 +51,26 @@ function user_relationships_api_schema()
 }
 
 /**
- * Install
+ * Implementation of hook_install().
  */
 function user_relationships_api_install() {
   drupal_install_schema('user_relationships_api');
 }
 
 /**
- * Uninstall
+ * Implementation of hook_uninstall().
  */
 function user_relationships_api_uninstall() {
   drupal_uninstall_schema('user_relationships_api');
 }
+
+/**
+ * Implementation of hook_update_N().
+ * Update 6100 changes the {user_relationships} rid column from an INT to a SERIAL type.
+ */
+function user_relationships_api_update_6100() {
+  $ret = array();
+  db_drop_index($ret, 'user_relationships', 'rid');
+  db_change_field($ret, 'user_relationships', 'rid', 'rid', array('type' => 'serial', 'not null' => TRUE), array('primary key' => array('rid'))); 
+  return $ret;
+}
Index: user_relationships_api/user_relationships_api.api.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/user_relationships/user_relationships_api/Attic/user_relationships_api.api.inc,v
retrieving revision 1.1.2.9
diff -b -u -p -r1.1.2.9 user_relationships_api.api.inc
--- user_relationships_api/user_relationships_api.api.inc	14 Jan 2009 10:58:30 -0000	1.1.2.9
+++ user_relationships_api/user_relationships_api.api.inc	29 Jan 2009 14:30:09 -0000
@@ -199,9 +199,6 @@ function user_relationships_save_relatio
       );
     }
   }
-  else {
-    $relationship->rid = db_result(db_query("SELECT MAX(rid) FROM {user_relationships}")) + 1;
-  }
 
   if ($valid = drupal_write_record('user_relationships', $relationship)) {
     // if the relationship has been approved and is two-way we need
