From e2e084a517dfe3c732b3147fddfb6d2cf481b65a Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 24 May 2010 17:19:02 -0600 Subject: [PATCH] IMP tables now created via migration script --- imp/docs/INSTALL | 14 ++---- imp/migration/1_imp_base_tables.php | 46 ++++++++++++++++++ imp/scripts/sql/imp.oci8.sql | 15 ------ imp/scripts/sql/imp.sql | 15 ------ imp/scripts/sql/imp.xml | 97 ------------------------------------- 5 files changed, 50 insertions(+), 137 deletions(-) create mode 100644 imp/migration/1_imp_base_tables.php delete mode 100644 imp/scripts/sql/imp.oci8.sql delete mode 100644 imp/scripts/sql/imp.sql delete mode 100644 imp/scripts/sql/imp.xml diff --git a/imp/docs/INSTALL b/imp/docs/INSTALL index 7be616969..828869163 100644 --- a/imp/docs/INSTALL +++ b/imp/docs/INSTALL @@ -268,17 +268,11 @@ Configuring IMP 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 diff --git a/imp/migration/1_imp_base_tables.php b/imp/migration/1_imp_base_tables.php new file mode 100644 index 000000000..3d788ec97 --- /dev/null +++ b/imp/migration/1_imp_base_tables.php @@ -0,0 +1,46 @@ + + * @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'); + } + +} diff --git a/imp/scripts/sql/imp.oci8.sql b/imp/scripts/sql/imp.oci8.sql deleted file mode 100644 index 242eee074..000000000 --- a/imp/scripts/sql/imp.oci8.sql +++ /dev/null @@ -1,15 +0,0 @@ -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); diff --git a/imp/scripts/sql/imp.sql b/imp/scripts/sql/imp.sql deleted file mode 100644 index ef896e077..000000000 --- a/imp/scripts/sql/imp.sql +++ /dev/null @@ -1,15 +0,0 @@ -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); diff --git a/imp/scripts/sql/imp.xml b/imp/scripts/sql/imp.xml deleted file mode 100644 index 8b6f5207e..000000000 --- a/imp/scripts/sql/imp.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - name - false - false - - - - imp_sentmail - - - - - sentmail_id - integer - true - - - - sentmail_who - text - 255 - true - - - - sentmail_ts - integer - true - - - - sentmail_messageid - text - 255 - true - - - - sentmail_action - text - 32 - true - - - - sentmail_recipient - text - 255 - true - - - - sentmail_success - integer - 1 - true - - - - imp_primary - true - - sentmail_id - - - - - sentmail_ts - - sentmail_ts - ascending - - - - - sentmail_who - - sentmail_who - ascending - - - - - sentmail_success - - sentmail_success - ascending - - - - - -
- -
-- 2.11.0