--- D:/Install_files/Web/CMS/drupal-modules/authorship-original/authorship/authorship.install Tue Feb 06 20:07:22 2007 +++ D:/Install_files/Web/CMS/drupal-modules/authorship/authorship.install Tue Apr 10 16:10:21 2007 @@ -18,9 +18,10 @@ case 'mysqli': $query1 = db_query("CREATE TABLE IF NOT EXISTS {node_authorship} (". "nid INT(10) NOT NULL DEFAULT 0,". + "cid INT(10) NOT NULL DEFAULT 0,". "authorship VARCHAR(255) NOT NULL DEFAULT '',". "profile_real_name INT(2) DEFAULT 0, ". - "PRIMARY KEY (nid),". + "PRIMARY KEY (nid, cid),". "INDEX(authorship(8))". ") /*!40100 DEFAULT CHARACTER SET utf8 */"); if($query1) { @@ -31,9 +32,10 @@ case 'pgsql': $query1 = db_query("CREATE TABLE {node_authorship} (". "nid INT NOT NULL DEFAULT 0,". + "cid INT NOT NULL DEFAULT 0,". "authorship VARCHAR(255) NOT NULL DEFAULT '',". "profile_real_name SMALLINT DEFAULT 0, ". - "PRIMARY KEY (nid)"); + "PRIMARY KEY (nid, cid)"); $query2 = db_query("CREATE INDEX node_authorship_idx ON {node_authorship} (authorship);"); if($query1 && $query2) { $created = TRUE; @@ -67,6 +69,31 @@ } } return $items; +} + +function authorship_update_2() { + $items = array(); + $items[] = update_sql("ALTER TABLE {node_authorship} ADD cid INT(10) NOT NULL DEFAULT 0 AFTER nid"); + $items[] = update_sql("ALTER TABLE {node_authorship} DROP PRIMARY KEY"); + $items[] = update_sql("ALTER TABLE {node_authorship} ADD PRIMARY KEY (nid, cid)"); + return $items; +} + +/** +* Implementation of hook_uninstall(). +*/ +function authorship_uninstall() { + if(db_table_exists('{node_authorship}')) { + db_query('DROP TABLE {node_authorship}'); + } + // delete variables + $node_types = node_get_types('names'); + $node_types = array_keys($node_types); + $node_types[] = 'comment'; + foreach($node_types as $node_type) { + variable_del('authorship_real_name_' . $node_type); + variable_del('authorship_' . $node_type); + } }