Index: acl.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/acl/acl.install,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 acl.install
--- acl.install	9 Nov 2007 10:03:35 -0000	1.1.2.4
+++ acl.install	9 Nov 2007 10:43:34 -0000
@@ -9,26 +9,25 @@
         acl_id int(10) NOT NULL default 0,
         module varchar(255),
         name varchar(255),
-        KEY acl_id (acl_id)
-      );");
+        PRIMARY KEY acl_id (acl_id)
+        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
 
       db_query("create table if not exists {acl_user} (
         acl_id int(10) NOT NULL default 0,
         uid int(10) NOT NULL default 0,
-        KEY acl_id (acl_id),
-        KEY uid (uid)
-      );");
-    
+        PRIMARY KEY acl_id (acl_id, uid)
+        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
+
       db_query("create table if not exists {acl_node} (
         acl_id int(10) NOT NULL default 0,
         nid int(10) NOT NULL default 0,
         grant_view tinyint(1) unsigned NOT NULL default '0',
         grant_update tinyint(1) unsigned NOT NULL default '0',
         grant_delete tinyint(1) unsigned NOT NULL default '0',
-        KEY acl_id (acl_id),
-        KEY nid (nid)
-      );");
+        PRIMARY KEY acl_id (acl_id, nid)
+        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
       break;
+
     case 'pgsql':
       db_query("CREATE TABLE {acl} (
         acl_id integer NOT NULL DEFAULT 0,
@@ -41,25 +40,24 @@
       db_query("CREATE TABLE {acl_user} (
         acl_id integer NOT NULL DEFAULT 0,
         uid int NOT NULL DEFAULT 0,
-        PRIMARY KEY (acl_id)
+        PRIMARY KEY (acl_id, uid)
       );");
-    
       db_query("CREATE TABLE {acl_node} (
         acl_id integer NOT NULL DEFAULT 0,
         nid int NOT NULL DEFAULT 0,
         grant_view smallint NOT NULL default 0,
         grant_update smallint NOT NULL default 0,
         grant_delete smallint NOT NULL default 0,
-        PRIMARY KEY (acl_id)
+        PRIMARY KEY (acl_id, nid)
       );");
-
-      db_query("CREATE INDEX {acl_node}_nid ON {acl_node} (nid)");
-
       break;
   }
-  drupal_set_message("acl database tables created.");
 }
 
+/**
+ * Fixes table prefix
+ */
+
 // fix our sequences entry to support database prefixes
 function acl_update_1() {
   $ret = array();
@@ -78,3 +76,63 @@
   }
   return $ret;
 }
+
+/**
+ * Fixes primary keys
+ */
+function acl_update_2() {
+  $ret = array();
+  switch ($GLOBALS['db_type']) {
+    case 'mysqli':
+    case 'mysql':
+      $ret[] = update_sql('ALTER TABLE {acl} ADD PRIMARY KEY (acl_id)');
+      $ret[] = update_sql('ALTER TABLE {acl_user} ADD PRIMARY KEY (acl_id, uid)');
+      $ret[] = update_sql('ALTER TABLE {acl_node} ADD PRIMARY KEY (acl_id, nid)');
+      //drop the previous created and now unnecessary index
+      $ret[] = update_sql('ALTER TABLE {acl} DROP INDEX acl_id');
+      $ret[] = update_sql('ALTER TABLE {acl_user} DROP INDEX acl_id');
+      $ret[] = update_sql('ALTER TABLE {acl_user} DROP INDEX uid');
+      $ret[] = update_sql('ALTER TABLE {acl_node} DROP INDEX acl_id');
+      $ret[] = update_sql('ALTER TABLE {acl_node} DROP INDEX nid');
+      break;
+
+    case 'pgsql':
+      $ret[] = update_sql('ALTER TABLE {acl} DROP PRIMARY KEY , ADD PRIMARY KEY (acl_id)');
+      $ret[] = update_sql('ALTER TABLE {acl_user} DROP PRIMARY KEY , ADD PRIMARY KEY (acl_id, uid)');
+      $ret[] = update_sql('ALTER TABLE {acl_node} DROP PRIMARY KEY , ADD PRIMARY KEY (acl_id, nid)');
+      break;
+  }
+  return $ret;
+}
+
+/*
+ * Updates tables to use utf8 for mysql
+ */
+function acl_update_3() {
+  $ret = array();
+  // Only for MySQL 4.1+
+  switch ($GLOBALS['db_type']) {
+      case 'mysqli':
+        break;
+      case 'mysql':
+        if (version_compare(mysql_get_server_info($GLOBALS['active_db']), '4.1.0', '<')) {
+          return array();
+        }
+        break;
+      case 'pgsql':
+        return array();
+  }
+  $ret = update_convert_table_utf8('acl');
+  $ret = array_merge($ret, update_convert_table_utf8('acl_node'));
+  $ret = array_merge($ret, update_convert_table_utf8('acl_user'));
+  return $ret;
+}
+
+/*
+ * Implementation of hook_uninstall
+ */
+function acl_uninstall() {
+  db_query('DROP TABLE {acl}');
+  db_query('DROP TABLE {acl_user}');
+  db_query('DROP TABLE {acl_node}'); 
+}
Index: CHANGELOG.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/acl/Attic/CHANGELOG.txt,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 CHANGELOG.txt
--- CHANGELOG.txt	9 Nov 2007 10:03:35 -0000	1.1.2.6
+++ CHANGELOG.txt	9 Nov 2007 10:43:34 -0000
@@ -2,6 +2,7 @@
 
 ACL 5.x-1.x:
   Bugs fixed:
+    o fixed acl db scheme (primary keys, utf8) and added an uninstallation routine
     o acl_id created without $db_prefix when using shared table.
 
 
