Index: usernode.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/usernode/usernode.info,v
retrieving revision 1.3
diff -u -r1.3 usernode.info
--- usernode.info	18 Jun 2007 22:54:05 -0000	1.3
+++ usernode.info	4 Dec 2007 15:31:10 -0000
@@ -2,3 +2,4 @@
 name = "Usernode"
 description = "Automatic creation and deletion of usernodes - one node for each user."
 package = "Node Profile"
+core = 6.x
Index: usernode.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/usernode/usernode.install,v
retrieving revision 1.8
diff -u -r1.8 usernode.install
--- usernode.install	12 Oct 2007 14:26:59 -0000	1.8
+++ usernode.install	4 Dec 2007 15:31:10 -0000
@@ -3,29 +3,36 @@
 
 if (!defined('USERNODE_CONTENT_TYPE')) {
   //if the module isn't included yet, we need to make this define so that things are working...
-  define('USERNODE_CONTENT_TYPE', "usernode");
+  define('USERNODE_CONTENT_TYPE', 'usernode');
+}
+
+function usernode_schema() {
+  $schema = array();
+
+  $schema['usernode'] = array(
+    'description' => 'Relates uid in the {user} table with nid in the {node} table.',
+    'fields' => array(
+      'nid' => array(
+        'type' => 'int',
+        'unsigned' => true,
+        'not null' => true,
+        'disp-width' => '10'
+      ),
+      'uid' => array(
+        'type' => 'int',
+        'unsigned' => true,
+        'not null' => true,
+        'disp-width' => '10'
+      )
+    ),
+    'primary key' => array('uid', 'nid')
+  );
+
+  return $schema;
 }
 
 function usernode_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysqli':
-    case 'mysql':
-      db_query("CREATE TABLE if not exists {usernode} (
-        nid int(10) unsigned NOT NULL,
-        uid int(10) unsigned NOT NULL,
-        PRIMARY KEY(uid,nid)
-      ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      break;
-    case 'pgsql':
-      db_query("CREATE TABLE {usernode} (
-        nid int_unsigned NOT NULL,
-        uid int_unsigned NOT NULL,
-        PRIMARY KEY(uid,nid)
-      )");
-      break;
-    default:
-      break;
-  }
+  drupal_install_schema('usernode');
 
   // Prevent the promotion of new usernode objects to the front page by default,
   // by only placing 'status' (the 'Published' option) into the node options.
@@ -38,14 +45,14 @@
   // so let's find and delete the usernodes manually
   $result = db_query("SELECT u.* FROM {users} u ".
                      "JOIN {node} n ON u.uid = n.uid ".
-                     "WHERE n.type = '". USERNODE_CONTENT_TYPE ."'");
+                     "WHERE n.type = '%s'", USERNODE_CONTENT_TYPE);
 
   while ($user = db_fetch_object($result)) {
     usernode_delete_node($user);
   }
 
-  db_query("DROP TABLE {usernode}");
-  db_query("DELETE FROM {node_type} WHERE type = '". USERNODE_CONTENT_TYPE ."'");
+  drupal_uninstall_schema('usernode');
+  db_query("DELETE FROM {node_type} WHERE type = '%s'", USERNODE_CONTENT_TYPE);
   variable_del('node_options_'. USERNODE_CONTENT_TYPE);
 }
 
