--- userpoints.install.orig	2007-06-05 02:48:56.000000000 -0400
+++ userpoints.install	2007-06-05 02:45:40.000000000 -0400
@@ -27,7 +27,30 @@ function userpoints_install() {
           status        int (1) NOT NULL default '0',
           PRIMARY KEY (txn_id)
         ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
- }
+      break;
+
+    case 'pgsql':
+      db_query("CREATE TABLE {userpoints} (
+          uid           SERIAL,
+	  points        integer NOT NULL default '0',
+	  max_points    integer NOT NULL default '0',
+	  last_update   integer NOT NULL default '0',
+	  PRIMARY KEY (uid)
+        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
+
+      db_query("CREATE TABLE {userpoints_txn} (
+          txn_id        SERIAL,
+	  uid           integer NOT NULL default '0',
+	  approver_uid  interger NOT NULL default '0',
+	  points        integer NOT NULL default '0',
+	  time_stamp    integer NOT NULL default '0',
+	  event         varchar,
+	  description   varchar,
+	  status        integer NOT NULL default '0',
+	  PRIMARY KEY (txn_id)
+	) /*!40100 DEFAULT CHARACTER SET utf8 */;");
+      break;
+  }
 }
 
 /**
@@ -64,6 +87,25 @@ function userpoints_update_2() {
       // Make the points column bigger
       $ret[] = update_sql("ALTER TABLE {userpoints} CHANGE points points int(10) NOT NULL default '0'");
       break;
+
+    case 'pgsql':
+      $ret[] = update_sql("
+        CREATE TABLE {userpoints_txn} (
+	  txn_id        SERIAL,
+	  uid           integer NOT NULL default '0',
+	  approver_uid  integer NOT NULL default '0',
+	  points        integer  NOT NULL default '0',
+	  time_stamp    integer NOT NULL default '0',
+	  event         VARCHAR,
+	  status        integer NOT NULL default '0',
+	  PRIMARY KEY (txn_id)
+	) /*!40100 DEFAULT CHARACTER SET utf8 */;");// Add the max_points column
+      $ret[] = update_sql("ALTER TABLE {userpoints} ADD max_points integer NOT NULL default '0'");
+      // Make the points column bigger
+      $ret[] = update_sql("ALTER TABLE {userpoints} ALTER points TYPE integer");
+      $ret[] = update_sql("ALTER TABLE {userpoints} ALTER points SET NOT NULL");
+      $ret[] = update_sql("ALTER TABLE {userpoints} ALTER points SET DEFAULT '0'");			    
+      break;
   }
   return $ret;
 }
@@ -76,6 +118,10 @@ function userpoints_update_3() {
       // Add the description column
       $ret[] = update_sql("ALTER TABLE {userpoints_txn} ADD description text AFTER event");
       break;
+    case 'mysql':
+      // Add the description column
+      $ret[] = update_sql("ALTER TABLE {userpoints_txn} ADD description varchar");
+      break;			  
   }
   return $ret;
 }
