2. Creating the database table
- The specific steps to create the IMP database table depend on which
- database you've chosen to use.
+ Creating the IMP database table(s) can be accomplished with horde's
+ ``db_migrate`` utility. If your database is properly setup in the Horde
+ configuration, just run the following:
- First, look in ``scripts/sql/`` to see if a script already exists
- for your database type. If so, you should be able to simply execute that
- script as superuser in your database. (Note that executing the script as
- the "horde" user will probably fail when granting privileges.)
-
- If such a script does not exist, you'll need to build your own, using the
- file imp.sql as a starting point. If you need assistance in creating
- databases, you may wish to let us know on the IMP mailing list.
+ horde/bin/db_migrate imp
3. Configuring IMP
--- /dev/null
+<?php
+/**
+ * Create IMP base tables.
+ *
+ * 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 ImpBaseTables extends Horde_Db_Migration_Base
+{
+ /**
+ * Upgrade.
+ */
+ public function up()
+ {
+ // Create: imp_sentmail
+ $t = $this->createTable('imp_sentmail', array('primaryKey' => 'sentmail_id'));
+ $t->column('sentmail_id', 'integer', array('autoincrement' => true));
+ $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));
+ $t->column('sentmail_action', 'string', array('limit' => 32, 'null' => false));
+ $t->column('sentmail_recipient', 'string', array('limit' => 255, 'null' => false));
+ $t->column('sentmail_success', 'integer', array('null' => false));
+ $t->end();
+
+ $this->addIndex('imp_sentmail', array('sentmail_ts'));
+ $this->addIndex('imp_sentmail', array('sentmail_who'));
+ $this->addIndex('imp_sentmail', array('sentmail_success'));
+ }
+
+ /**
+ * Downgrade.
+ */
+ public function down()
+ {
+ $this->dropTable('imp_sentmail');
+ }
+
+}
+++ /dev/null
-CREATE TABLE imp_sentmail (
- sentmail_id NUMBER(16) NOT NULL,
- sentmail_who VARCHAR2(255) NOT NULL,
- sentmail_ts NUMBER(16) NOT NULL,
- sentmail_messageid VARCHAR2(255) NOT NULL,
- sentmail_action VARCHAR2(32) NOT NULL,
- sentmail_recipient VARCHAR2(255) NOT NULL,
- sentmail_success NUMBER(1) NOT NULL,
---
- PRIMARY KEY (sentmail_id)
-);
-
-CREATE INDEX sentmail_ts_idx ON imp_sentmail (sentmail_ts);
-CREATE INDEX sentmail_who_idx ON imp_sentmail (sentmail_who);
-CREATE INDEX sentmail_success_idx ON imp_sentmail (sentmail_success);
+++ /dev/null
-CREATE TABLE imp_sentmail (
- sentmail_id BIGINT NOT NULL,
- sentmail_who VARCHAR(255) NOT NULL,
- sentmail_ts BIGINT NOT NULL,
- sentmail_messageid VARCHAR(255) NOT NULL,
- sentmail_action VARCHAR(32) NOT NULL,
- sentmail_recipient VARCHAR(255) NOT NULL,
- sentmail_success INT NOT NULL,
---
- PRIMARY KEY (sentmail_id)
-);
-
-CREATE INDEX sentmail_ts_idx ON imp_sentmail (sentmail_ts);
-CREATE INDEX sentmail_who_idx ON imp_sentmail (sentmail_who);
-CREATE INDEX sentmail_success_idx ON imp_sentmail (sentmail_success);
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<database>
-
- <name><variable>name</variable></name>
- <create>false</create>
- <overwrite>false</overwrite>
-
- <table>
-
- <name>imp_sentmail</name>
-
- <declaration>
-
- <field>
- <name>sentmail_id</name>
- <type>integer</type>
- <notnull>true</notnull>
- </field>
-
- <field>
- <name>sentmail_who</name>
- <type>text</type>
- <length>255</length>
- <notnull>true</notnull>
- </field>
-
- <field>
- <name>sentmail_ts</name>
- <type>integer</type>
- <notnull>true</notnull>
- </field>
-
- <field>
- <name>sentmail_messageid</name>
- <type>text</type>
- <length>255</length>
- <notnull>true</notnull>
- </field>
-
- <field>
- <name>sentmail_action</name>
- <type>text</type>
- <length>32</length>
- <notnull>true</notnull>
- </field>
-
- <field>
- <name>sentmail_recipient</name>
- <type>text</type>
- <length>255</length>
- <notnull>true</notnull>
- </field>
-
- <field>
- <name>sentmail_success</name>
- <type>integer</type>
- <length>1</length>
- <notnull>true</notnull>
- </field>
-
- <index>
- <name>imp_primary</name>
- <primary>true</primary>
- <field>
- <name>sentmail_id</name>
- </field>
- </index>
-
- <index>
- <name>sentmail_ts</name>
- <field>
- <name>sentmail_ts</name>
- <sorting>ascending</sorting>
- </field>
- </index>
-
- <index>
- <name>sentmail_who</name>
- <field>
- <name>sentmail_who</name>
- <sorting>ascending</sorting>
- </field>
- </index>
-
- <index>
- <name>sentmail_success</name>
- <field>
- <name>sentmail_success</name>
- <sorting>ascending</sorting>
- </field>
- </index>
-
- </declaration>
-
- </table>
-
-</database>