More places to fix primary key generation
authorMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 7 Oct 2010 17:54:11 +0000 (13:54 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 7 Oct 2010 17:54:11 +0000 (13:54 -0400)
wicked/migration/1_wicked_base_tables.php

index aba6410..89228c8 100644 (file)
@@ -39,7 +39,7 @@ class WickedBaseTables extends Horde_Db_Migration_Base
         }
 
         if (!in_array('wicked_history', $tableList)) {
-            $t = $this->createTable('wicked_history', array('primaryKey' => array('page_id', 'page_majorversion', 'page_minorversion')));
+            $t = $this->createTable('wicked_history', array('primaryKey' => false));
             $t->column('page_id', 'integer', array('null' => false));
             $t->column('page_name', 'string', array('limit' => 100, 'null' => false));
             $t->column('page_text', 'text');
@@ -48,13 +48,14 @@ class WickedBaseTables extends Horde_Db_Migration_Base
             $t->column('version_created', 'integer', array('null' => false));
             $t->column('change_author', 'string');
             $t->column('change_log', 'text');
+            $t->primaryKey(array('page_id', 'page_majorversion', 'page_minorversion'));
             $t->end();
             $this->addIndex('wicked_history', array('page_name'));
             $this->addIndex('wicked_history', array('page_majorversion', 'page_minorversion'));
         }
 
         if (!in_array('wicked_attachments', $tableList)) {
-            $t = $this->createTable('wicked_attachments', array('primaryKey' => array('page_id', 'attachment_name')));
+            $t = $this->createTable('wicked_attachments', array('primaryKey' => false));
             $t->column('page_id', 'integer', array('null' => false));
             $t->column('attachment_name', 'string', array('limit' => 100, 'null' => false));
             $t->column('attachment_hits', 'integer', array('default' => 0));
@@ -63,11 +64,12 @@ class WickedBaseTables extends Horde_Db_Migration_Base
             $t->column('attachment_created', 'integer', array('null' => false));
             $t->column('change_author', 'string');
             $t->column('change_log', 'text');
+            $t->primaryKey(array('page_id', 'attachment_name'));
             $t->end();
         }
 
         if (!in_array('wicked_attachment_history', $tableList)) {
-            $t = $this->createTable('wicked_attachment_history', array('primaryKey' => array('page_id', 'attachment_name', 'attachment_majorversion', 'attachment_minorversion')));
+            $t = $this->createTable('wicked_attachment_history', array('primaryKey' => false));
             $t->column('page_id', 'integer', array('null' => false));
             $t->column('attachment_name', 'string', array('limit' => 100, 'null' => false));
             $t->column('attachment_majorversion', 'integer', array('null' => false));
@@ -75,6 +77,7 @@ class WickedBaseTables extends Horde_Db_Migration_Base
             $t->column('attachment_created', 'integer', array('null' => false));
             $t->column('change_author', 'string');
             $t->column('change_log', 'text');
+            $t->primaryKey(array('page_id', 'attachment_name', 'attachment_majorversion', 'attachment_minorversion'));
             $t->end();
             $this->addIndex('wicked_attachment_history', array('attachment_majorversion', 'attachment_minorversion'));
         }