From 37a67a46b67f6d789b3fe2616399f23b9f59b9df Mon Sep 17 00:00:00 2001
From: Axel Rutz <axel.rutz@clever-systems.net>
Date: Sun, 11 Nov 2012 22:16:03 +0100
Subject: [PATCH] eck issue #1681636: Installation: SQL error, Duplicate
 PRIMARY key

---
 eck.install |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/eck.install b/eck.install
index a986d38..f70fb2f 100644
--- a/eck.install
+++ b/eck.install
@@ -89,20 +89,16 @@ function eck_schema() {
         'description' => 'A serialized list of custom properties attached to this entity.',
       )*/      
     ),
-    'primary key' => array('id', 'name'),
+    'primary key' => array('id'),
+    'unique keys' => array(
+      'name' => array('name'),
+    ),
     'indexes' => array()
   );
 
   $schema['eck_bundle'] = array(
     'description' => "The base table for bundle information",
     'fields' => array(
-    /*Really the identifier should be some sort of combination between'
-     * the entity type the bundle belongs too, and the bundles name 
-     * but since I don't know db stuff to that extent, i will leave this
-     * useless id hanging around , well it seems liek CTools exportable
-     * do expect some sort of id beyond the machina_name, so we will
-     * leave here and added back to the types, just in case that we 
-     * use CTools exportables*/
       'id' => array(
         'description' => "The primary identifier for a bundle",
         'type' => 'serial',
@@ -143,6 +139,9 @@ function eck_schema() {
       ),
     ),
     'primary key' => array('id'/*, 'machine_name'*/), //sad.. taken this out until I figure out how to make it work
+    'unique keys' => array(
+      'machine_name' => array('machine_name'),
+    ),
     'indexes' => array(
       /*'entity_type_bundle'      => array('entity_type', 'name'),*/ //Nope, Don't need it
     ),
@@ -198,7 +197,7 @@ function eck_update_7000() {
       )
     ),
     'primary key' => array('id'),
-    'indexes' => array(
+    'unique keys' => array(
       'entity_type'      => array('entity', 'type'),
     ),
   );
-- 
1.7.5.4

