--- click.install	2007-01-29 19:29:51.000000000 +0000
+++ clickNew.install	2010-03-23 09:34:46.000000000 +0000
@@ -1,27 +1,66 @@
 <?php
 // $Id: click.install,v 1.3 2007/01/29 19:29:51 kbahey Exp $
 
+/**
+ * Implementation of hook_install().
+ */
 function click_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      $query = db_query("CREATE TABLE {clicks} (
-        gid          int(2)  NOT NULL default '0',
-        nid          int(10) NOT NULL default '0',
-        day_clicks   int(10) NOT NULL default '0',
-        week_clicks  int(10) NOT NULL default '0',
-        total_clicks int(10) NOT NULL default '0',
-        start        int(10) NOT NULL default '0',
-        last         int(10) NOT NULL default '0',
-        PRIMARY KEY (gid, nid)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      break;
-    case 'pgsql':
-      break;
-  }
+  // Create tables.
+  drupal_install_schema('click');
 }
 
-function click_update_1() {
-  return _system_update_utf8(array('clicks'));
+/**
+ * Implementation of hook_uninstall().
+ */
+function click_uninstall() {
+  // Remove tables.
+  drupal_uninstall_schema('click');
 }
 
+function click_schema() {
+	$schema = array();
+	$schema['clicks'] = array(
+		'fields' => array(
+			'gid' => array(
+				'type' => 'int',
+				'size' => 'small',
+				'unsigned' => TRUE,
+				'not null' => TRUE,
+			),
+			'nid' => array(
+				'type' => 'int',
+				'unsigned' => TRUE,
+				'not null' => TRUE,
+			),
+			'day_clicks' => array(
+				'type' => 'int',
+				'unsigned' => TRUE,
+				'not null' => TRUE,
+			),
+			'week_clicks' => array(
+				'type' => 'int',
+				'unsigned' => TRUE,
+				'not null' => TRUE,
+			),
+			'total_clicks' => array(
+				'type' => 'int',
+				'unsigned' => TRUE,
+				'not null' => TRUE,
+			),
+			'start' => array(
+				'type' => 'int',
+				'unsigned' => TRUE,
+				'not null' => TRUE,
+			),
+			'last' => array(
+				'type' => 'int',
+				'unsigned' => TRUE,
+				'not null' => TRUE,
+			),
+		),
+		'primary key' => array(
+			'gid', 'nid'
+		), 
+	);
+	return $schema;
+}
\ No newline at end of file
