1a2
> // Based upon:
2a4,9
> // Community tags for Drupal6 v0.1 2008/08/14 nburles
> 
> /**
>  * @file
>  * The install file for the community_tags module drupal6 version
>  */
8,48c15,16
<   $status = array();
<   switch ($GLOBALS['db_type']) {
<     case 'mysql':
<     case 'mysqli':
<       $status[] = db_query("CREATE TABLE {community_tags} (
<         tid int(10) unsigned NOT NULL DEFAULT '0',
<         nid int(10) unsigned NOT NULL DEFAULT '0',
<         uid int(10) unsigned NOT NULL DEFAULT '0',
<         date int(10) unsigned NOT NULL DEFAULT '0',
<         PRIMARY KEY  (tid,nid,uid),
<         KEY tid (tid),
<         KEY nid (nid),
<         KEY uid (uid)
<       ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
<       break;
< 
<     case 'pgsql':
<       $status[] = db_query("CREATE TABLE {community_tags} (
<         tid integer NOT NULL DEFAULT '0',
<         nid integer NOT NULL DEFAULT '0',
<         uid integer NOT NULL DEFAULT '0',
<         date integer NOT NULL DEFAULT '0',
<         PRIMARY KEY (tid,nid,uid)
<       );");
<       $status[] = db_query("CREATE INDEX {community_tags}_tid_idx ON {community_tags} (tid);");
<       $status[] = db_query("CREATE INDEX {community_tags}_nid_idx ON {community_tags} (nid);");
<       $status[] = db_query("CREATE INDEX {community_tags}_uid_idx ON {community_tags} (uid);");
<       break;
<   }
< 
<   // Drop module weight so we act after taxonomy.
<   $weight = (int)db_result(db_query("SELECT weight FROM {system} WHERE name = 'taxonomy'"));
<   db_query("UPDATE {system} SET weight = %d WHERE name = 'community_tags'", $weight + 1);
< 
<   // If there is one FALSE value in the status array, there was an error.
<   if (array_search(FALSE, $status) !== FALSE) {
<     drupal_set_message(t('Table installation for the Community Tags module was unsuccessful. The tables may need to be installed by hand.'), 'error');
<   }
<   else {
<     drupal_set_message(t('Community Tags module installed successfully.'));
<   }
---
>   // create tables
>   drupal_install_schema('community_tags');
55c23,45
<   db_query('DROP TABLE {community_tags}');
---
>   // remove tables
>   drupal_uninstall_schema('community_tags');
> }
> 
> /**
>  * Implementation of hook_schema().
>  */
> function community_tags_schema() {
>   $schema['community_tags'] = array(
>     'fields' => array(
>       'tid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
>       'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
>       'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
>       'date' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
>     ),
>     'indexes' => array(
>       'tid' => array('tid'),
>       'nid' => array('nid'),
>       'uid' => array('uid'),
>     ),
>     'primary key' => array('tid', 'uid', 'nid'),
>   );
>   return $schema;
62,73c52,53
<   $items = array();
<   switch ($GLOBALS['db_type']) {
<     case 'mysql':
<     case 'mysqli':
<       $items[] = update_sql('ALTER TABLE {community_tags} ADD KEY tid (tid)');
<       break;
< 
<     case 'pgsql':
<       $items[] = update_sql("CREATE INDEX {community_tags}_tid_idx ON {community_tags} (tid);");
<       break;
<   }
< 
---
>   $ret = array();
>   db_add_index($ret, 'community_tags', 'tid', array('tid'));
75,76c55
< 
<   return $items;
---
>   return $ret;
