Add autoincrement update script
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 26 May 2010 16:03:31 +0000 (10:03 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 26 May 2010 17:00:44 +0000 (11:00 -0600)
imp/migration/1_imp_base_tables.php
imp/migration/2_imp_autoincrement_sentmail.php [new file with mode: 0644]

index 3d788ec..cad1632 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Create IMP base tables.
+ * Create IMP base tables (as of IMP 4.3).
  *
  * Copyright 2010 The Horde Project (http://www.horde.org/)
  *
@@ -21,7 +21,7 @@ class ImpBaseTables extends Horde_Db_Migration_Base
     {
         // Create: imp_sentmail
         $t = $this->createTable('imp_sentmail', array('primaryKey' => 'sentmail_id'));
-        $t->column('sentmail_id', 'integer', array('autoincrement' => true));
+        $t->column('sentmail_id', 'bigint', array('null' => false));
         $t->column('sentmail_who', 'string', array('limit' => 255, 'null' => false));
         $t->column('sentmail_ts', 'bigint', array('null' => false));
         $t->column('sentmail_messageid', 'string', array('limit' => 255, 'null' => false));
diff --git a/imp/migration/2_imp_autoincrement_sentmail.php b/imp/migration/2_imp_autoincrement_sentmail.php
new file mode 100644 (file)
index 0000000..f03ebba
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Change sentmail_id column to autoincrement.
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author   Michael Slusarz <slusarz@horde.org>
+ * @category Horde
+ * @license  http://www.fsf.org/copyleft/gpl.html GPL
+ * @package  IMP
+ */
+class ImpAutoIncrementSentmail extends Horde_Db_Migration_Base
+{
+    /**
+     * Upgrade.
+     */
+    public function up()
+    {
+        $t->changeColumn('imp_sentmail', 'sentmail_id', 'integer', array('autoincrement' => true));
+    }
+
+    /**
+     * Downgrade.
+     */
+    public function down()
+    {
+        // No way to downgrade at this time.
+    }
+
+}