From: Michael J. Rubinsky Date: Thu, 7 Oct 2010 14:20:53 +0000 (-0400) Subject: Ingo migrations, remove legacy sql upgrade and creation scripts. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=00de7faca1d9b19146666aabe664b839ce386480;p=horde.git Ingo migrations, remove legacy sql upgrade and creation scripts. --- diff --git a/ingo/migration/1_ingo_base_tables.php b/ingo/migration/1_ingo_base_tables.php new file mode 100644 index 000000000..7ec0e029f --- /dev/null +++ b/ingo/migration/1_ingo_base_tables.php @@ -0,0 +1,145 @@ + + * @category Horde + * @license http://www.fsf.org/copyleft/gpl.html GPL + * @package Ingo + */ +class IngoBaseTables extends Horde_Db_Migration_Base +{ + /** + * Upgrade. + */ + public function up() + { + $tableList = $this->tables(); + + if (!in_array('ingo_rules', $tableList)) { + $t = $this->createTable('ingo_rules', array('primaryKey' => false)); + $t->column('rule_id', 'bigint', array('null' => false)); + $t->column('rule_owner', 'string', array('limit' => 255, 'null' => false)); + $t->column('rule_name', 'string', array('limit' => 255, 'null' => false)); + $t->column('rule_action', 'integer', array('null' => false)); + $t->column('rule_value', 'string', array('limit' => 255)); + $t->column('rule_flags', 'integer'); + $t->column('rule_conditions', 'text'); + $t->column('rule_combine', 'integer'); + $t->column('rule_stop', 'integer'); + $t->column('rule_active', 'integer', array('default' => 1, 'null' => false)); + $t->column('rule_order', 'integer', array('default' => 0, 'null' => false)); + $t->primaryKey(array('rule_id')); + $t->end(); + $this->addIndex('ingo_rules', array('rule_owner')); + } + + if (!in_array('ingo_lists', $tableList)) { + $t = $this->createTable('ingo_lists', array('primaryKey' => false)); + $t->column('list_owner', 'string', array('limit' => 255, 'null' => false)); + $t->column('list_blacklist', 'integer', array('default' => 0)); + $t->column('list_address', 'string', array('limit' => 255, 'null' => false)); + $t->end(); + $this->addIndex('ingo_lists', array('list_owner', 'list_blacklist')); + } + + if (!in_array('ingo_forwards', $tableList)) { + $t = $this->createTable('ingo_forwards', array('primaryKey' => false)); + $t->column('forward_owner', 'string', array('limit' => 255, 'null' => false)); + $t->column('forward_addresses', 'text'); + $t->column('forward_keep', 'integer', array('default' => 0, 'null' => false)); + $t->end(); + } + + if (!in_array('ingo_vacations', $tableList)) { + $t = $this->createTable('ingo_vacations', array('primaryKey' => false)); + $t->column('vacation_owner', 'string', array('limit' => 255, 'null' => false)); + $t->column('vacation_addresses', 'text'); + $t->column('vacation_subject', 'string', array('limit' => 255)); + $t->column('vacation_reason', 'text'); + $t->column('vacation_days', 'integer', array('default' => 7)); + $t->column('vacation_start', 'integer'); + $t->column('vacation_end', 'integer'); + $t->column('vacation_excludes', 'text'); + $t->column('vacation_ignorelists', 'integer', array('default' => 1)); + $t->primaryKey(array('vacation_owner')); + $t->end(); + } + + if (!in_array('ingo_spam', $tableList)) { + $t = $this->createTable('ingo_spam', array('primaryKey' => false)); + $t->column('spam_owner', 'string', array('limit' => 255, 'null' => false)); + $t->column('spam_level', 'integer', array('default' => 5)); + $t->column('spam_folder', 'string', array('limit' => 255)); + $t->primaryKey(array('spam_owner')); + $t->end(); + } + if (!in_array('ingo_shares', $tableList)) { + $t = $this->createTable('ingo_shares', array('primaryKey' => false)); + $t->column('share_id', 'integer', array('null' => false)); + $t->column('share_name', 'string', array('limit' => 255, 'null' => false)); + $t->column('share_owner', 'string', array('limit' => 255, 'null' => false)); + $t->column('share_flags', 'integer', array('default' => 0, 'null' => false)); + $t->column('perm_creator', 'integer', array('default' => 0, 'null' => false)); + $t->column('perm_default', 'integer', array('default' => 0, 'null' => false)); + $t->column('perm_guest', 'integer', array('default' => 0, 'null' => false)); + $t->column('attribute_name', 'string', array('limit' => 255, 'null' => false)); + $t->column('attribute_desc', 'string', array('limit' => 255)); + $t->primaryKey(array('share_id')); + $t->end(); + + $this->addIndex('ingo_shares', 'share_name'); + $this->addIndex('ingo_shares', 'share_owner'); + $this->addIndex('ingo_shares', 'perm_creator'); + $this->addIndex('ingo_shares', 'perm_default'); + $this->addIndex('ingo_shares', 'perm_guest'); + } + + if (!in_array('ingo_shares_groups', $tableList)) { + $t = $this->createTable('ingo_shares_groups'); + $t->column('share_id', 'integer', array('null' => false)); + $t->column('group_uid', 'string', array('limit' => 255, 'null' => false)); + $t->column('perm', 'integer', array('null' => false)); + $t->end(); + + $this->addIndex('ingo_shares_groups', 'share_id'); + $this->addIndex('ingo_shares_groups', 'group_uid'); + $this->addIndex('ingo_shares_groups', 'perm'); + } + + if (!in_array('ingo_shares_users', $tableList)) { + $t = $this->createTable('ingo_shares_users'); + $t->column('share_id', 'integer', array('null' => false)); + $t->column('user_uid', 'string', array('limit' => 255)); + $t->column('perm', 'integer', array('null' => false)); + $t->end(); + + $this->addIndex('ingo_shares_users', 'share_id'); + $this->addIndex('ingo_shares_users', 'user_uid'); + $this->addIndex('ingo_shares_users', 'perm'); + } + + } + + /** + * Downgrade + * + */ + public function down() + { + $this->dropTable('ingo_rules'); + $this->dropTable('ingo_lists'); + $this->dropTable('ingo_forwards'); + $this->dropTable('ingo_vacations'); + $this->dropTable('ingo_spam'); + $this->dropTable('ingo_shares'); + $this->dropTable('ingo_shares_groups'); + $this->dropTable('ingo_shares_users'); + } + +} diff --git a/ingo/migration/2_ingo_upgrade_autoincrement.php b/ingo/migration/2_ingo_upgrade_autoincrement.php new file mode 100644 index 000000000..053ee1acb --- /dev/null +++ b/ingo/migration/2_ingo_upgrade_autoincrement.php @@ -0,0 +1,36 @@ + + * @category Horde + * @license http://www.fsf.org/copyleft/gpl.html GPL + * @package Ingo + */ +class IngoUpgradeAutoIncrement extends Horde_Db_Migration_Base +{ + /** + * Upgrade. + */ + public function up() + { + $this->changeColumn('ingo_rules', 'rule_id', 'bigint', array('null' => false, 'autoincrement' => true)); + $this->changeColumn('ingo_shares', 'share_id', 'integer', array('null' => false, 'autoincrement' => true)); + } + + /** + * Downgrade + * + */ + public function down() + { + $this->changeColumn('ingo_rules', 'rule_id', 'bigint', array('null' => false)); + $this->changeColumn('ingo_shares', 'share_id', 'integer', array('null' => false)); + } + +} diff --git a/ingo/scripts/sql/ingo.oci8.sql b/ingo/scripts/sql/ingo.oci8.sql deleted file mode 100644 index 82417b173..000000000 --- a/ingo/scripts/sql/ingo.oci8.sql +++ /dev/null @@ -1,99 +0,0 @@ -CREATE TABLE ingo_rules ( - rule_id NUMBER(16) NOT NULL, - rule_owner VARCHAR2(255) NOT NULL, - rule_name VARCHAR2(255) NOT NULL, - rule_action NUMBER(16) NOT NULL, - rule_value VARCHAR2(255), - rule_flags NUMBER(16), - rule_conditions CLOB, - rule_combine NUMBER(16), - rule_stop NUMBER(1), - rule_active NUMBER(1) DEFAULT 1 NOT NULL, - rule_order NUMBER(16) DEFAULT 0 NOT NULL, --- - PRIMARY KEY (rule_id) -); - -CREATE INDEX rule_owner_idx ON ingo_rules (rule_owner); - - -CREATE TABLE ingo_lists ( - list_owner VARCHAR2(255) NOT NULL, - list_blacklist NUMBER(1) DEFAULT 0, - list_address VARCHAR2(255) NOT NULL -); - -CREATE INDEX list_idx ON ingo_lists (list_owner, list_blacklist); - - -CREATE TABLE ingo_forwards ( - forward_owner VARCHAR2(255) NOT NULL, - forward_addresses CLOB, - forward_keep NUMBER(16) DEFAULT 0 NOT NULL, --- - PRIMARY KEY (forward_owner) -); - - -CREATE TABLE ingo_vacations ( - vacation_owner VARCHAR2(255) NOT NULL, - vacation_addresses CLOB, - vacation_subject VARCHAR2(255), - vacation_reason CLOB, - vacation_days NUMBER(16) DEFAULT 7, - vacation_start NUMBER(16), - vacation_end NUMBER(16), - vacation_excludes CLOB, - vacation_ignorelists NUMBER(1) DEFAULT 1, --- - PRIMARY KEY (vacation_owner) -); - - -CREATE TABLE ingo_spam ( - spam_owner VARCHAR2(255) NOT NULL, - spam_level NUMBER(16) DEFAULT 5, - spam_folder VARCHAR2(255), --- - PRIMARY KEY (spam_owner) -); - - -CREATE TABLE ingo_shares ( - share_id NUMBER(16) NOT NULL, - share_name VARCHAR2(255) NOT NULL, - share_owner VARCHAR2(255) NOT NULL, - share_flags NUMBER(8) DEFAULT 0 NOT NULL, - perm_creator NUMBER(8) DEFAULT 0 NOT NULL, - perm_default NUMBER(8) DEFAULT 0 NOT NULL, - perm_guest NUMBER(8) DEFAULT 0 NOT NULL, - attribute_name VARCHAR2(255) NOT NULL, - attribute_desc VARCHAR2(255), - PRIMARY KEY (share_id) -); - -CREATE INDEX ingo_shares_name_idx ON ingo_shares (share_name); -CREATE INDEX ingo_shares_owner_idx ON ingo_shares (share_owner); -CREATE INDEX ingo_shares_creator_idx ON ingo_shares (perm_creator); -CREATE INDEX ingo_shares_default_idx ON ingo_shares (perm_default); -CREATE INDEX ingo_shares_guest_idx ON ingo_shares (perm_guest); - -CREATE TABLE ingo_shares_groups ( - share_id NUMBER(16) NOT NULL, - group_uid VARCHAR2(255) NOT NULL, - perm NUMBER(8) NOT NULL -); - -CREATE INDEX ingo_groups_share_id_idx ON ingo_shares_groups (share_id); -CREATE INDEX ingo_groups_group_uid_idx ON ingo_shares_groups (group_uid); -CREATE INDEX ingo_groups_perm_idx ON ingo_shares_groups (perm); - -CREATE TABLE ingo_shares_users ( - share_id NUMBER(16) NOT NULL, - user_uid VARCHAR2(255) NOT NULL, - perm NUMBER(8) NOT NULL -); - -CREATE INDEX ingo_users_share_id_idx ON ingo_shares_users (share_id); -CREATE INDEX ingo_users_user_uid_idx ON ingo_shares_users (user_uid); -CREATE INDEX ingo_users_perm_idx ON ingo_shares_users (perm); diff --git a/ingo/scripts/sql/ingo.sql b/ingo/scripts/sql/ingo.sql deleted file mode 100644 index b95613588..000000000 --- a/ingo/scripts/sql/ingo.sql +++ /dev/null @@ -1,99 +0,0 @@ -CREATE TABLE ingo_rules ( - rule_id INT NOT NULL, - rule_owner VARCHAR(255) NOT NULL, - rule_name VARCHAR(255) NOT NULL, - rule_action INT NOT NULL, - rule_value VARCHAR(255), - rule_flags INT, - rule_conditions TEXT, - rule_combine INT, - rule_stop INT, - rule_active INT DEFAULT 1 NOT NULL, - rule_order INT DEFAULT 0 NOT NULL, --- - PRIMARY KEY (rule_id) -); - -CREATE INDEX rule_owner_idx ON ingo_rules (rule_owner); - - -CREATE TABLE ingo_lists ( - list_owner VARCHAR(255) NOT NULL, - list_blacklist INT DEFAULT 0, - list_address VARCHAR(255) NOT NULL -); - -CREATE INDEX list_idx ON ingo_lists (list_owner, list_blacklist); - - -CREATE TABLE ingo_forwards ( - forward_owner VARCHAR(255) NOT NULL, - forward_addresses TEXT, - forward_keep INT DEFAULT 0 NOT NULL, --- - PRIMARY KEY (forward_owner) -); - - -CREATE TABLE ingo_vacations ( - vacation_owner VARCHAR(255) NOT NULL, - vacation_addresses TEXT, - vacation_subject VARCHAR(255), - vacation_reason TEXT, - vacation_days INT DEFAULT 7, - vacation_start INT, - vacation_end INT, - vacation_excludes TEXT, - vacation_ignorelists INT DEFAULT 1, --- - PRIMARY KEY (vacation_owner) -); - - -CREATE TABLE ingo_spam ( - spam_owner VARCHAR(255) NOT NULL, - spam_level INT DEFAULT 5, - spam_folder VARCHAR(255), --- - PRIMARY KEY (spam_owner) -); - - -CREATE TABLE ingo_shares ( - share_id INT NOT NULL, - share_name VARCHAR(255) NOT NULL, - share_owner VARCHAR(255) NOT NULL, - share_flags SMALLINT DEFAULT 0 NOT NULL, - perm_creator SMALLINT DEFAULT 0 NOT NULL, - perm_default SMALLINT DEFAULT 0 NOT NULL, - perm_guest SMALLINT DEFAULT 0 NOT NULL, - attribute_name VARCHAR(255) NOT NULL, - attribute_desc VARCHAR(255), - PRIMARY KEY (share_id) -); - -CREATE INDEX ingo_shares_share_name_idx ON ingo_shares (share_name); -CREATE INDEX ingo_shares_share_owner_idx ON ingo_shares (share_owner); -CREATE INDEX ingo_shares_perm_creator_idx ON ingo_shares (perm_creator); -CREATE INDEX ingo_shares_perm_default_idx ON ingo_shares (perm_default); -CREATE INDEX ingo_shares_perm_guest_idx ON ingo_shares (perm_guest); - -CREATE TABLE ingo_shares_groups ( - share_id INT NOT NULL, - group_uid VARCHAR(255) NOT NULL, - perm SMALLINT NOT NULL -); - -CREATE INDEX ingo_shares_groups_share_id_idx ON ingo_shares_groups (share_id); -CREATE INDEX ingo_shares_groups_group_uid_idx ON ingo_shares_groups (group_uid); -CREATE INDEX ingo_shares_groups_perm_idx ON ingo_shares_groups (perm); - -CREATE TABLE ingo_shares_users ( - share_id INT NOT NULL, - user_uid VARCHAR(255) NOT NULL, - perm SMALLINT NOT NULL -); - -CREATE INDEX ingo_shares_users_share_id_idx ON ingo_shares_users (share_id); -CREATE INDEX ingo_shares_users_user_uid_idx ON ingo_shares_users (user_uid); -CREATE INDEX ingo_shares_users_perm_idx ON ingo_shares_users (perm); diff --git a/ingo/scripts/sql/ingo.xml b/ingo/scripts/sql/ingo.xml deleted file mode 100644 index 21f5beba2..000000000 --- a/ingo/scripts/sql/ingo.xml +++ /dev/null @@ -1,556 +0,0 @@ - - - - name - false - false - - - - ingo_forwards - - - - - forward_owner - text - true - 255 - - - - forward_addresses - clob - false - - - - forward_keep - integer - 0 - true - 1 - - - - ingo_forwards_primary - true - - forward_owner - ascending - - - - - -
- - - - ingo_lists - - - - - list_owner - text - true - 255 - - - - list_blacklist - integer - 0 - true - 4 - - - - list_address - text - true - 255 - - - - ingo_lists_idx - - list_owner - ascending - - - list_blacklist - ascending - - - - - -
- - - - ingo_rules - - - - - rule_id - integer - true - 4 - - - - rule_owner - text - true - 255 - - - - rule_name - text - true - 255 - - - - rule_action - integer - true - 4 - - - - rule_value - text - - false - 255 - - - - rule_flags - integer - false - 4 - - - - rule_conditions - clob - false - - - - rule_combine - integer - false - 4 - - - - rule_stop - integer - false - 4 - - - - rule_active - integer - 1 - true - 4 - - - - rule_order - integer - 0 - true - 4 - - - - ingo_rules_primary - true - - rule_id - ascending - - - - - ingo_rules_rule_owner - - rule_owner - ascending - - - - - -
- - - - ingo_shares - - - - - share_id - integer - true - 4 - - - - share_name - text - true - 255 - - - - share_owner - text - false - 255 - - - - share_flags - integer - 0 - true - 2 - - - - perm_creator - integer - 0 - true - 2 - - - - perm_default - integer - 0 - true - 2 - - - - perm_guest - integer - 0 - true - 2 - - - - attribute_name - text - true - 255 - - - - attribute_desc - text - false - 255 - - - - ingo_shares_primary - true - - share_id - ascending - - - - - ingo_shares_name - - share_name - ascending - - - - - ingo_shares_owner - - share_owner - ascending - - - - - ingo_shares_creator - - perm_creator - ascending - - - - - ingo_shares_default - - perm_default - ascending - - - - - ingo_shares_guest - - perm_guest - ascending - - - - - -
- - - - ingo_shares_groups - - - - - share_id - integer - true - 4 - - - - group_uid - text - true - 255 - - - - perm - integer - true - 2 - - - - ingo_groups_share_id - - share_id - ascending - - - - - ingo_groups_group_uid - - group_uid - ascending - - - - - ingo_groups_perm - - perm - ascending - - - - - -
- - - - ingo_shares_users - - - - - share_id - integer - true - 4 - - - - user_uid - text - false - 255 - - - - perm - integer - true - 2 - - - - ingo_users_share_id - - share_id - ascending - - - - - ingo_users_user_uid - - user_uid - ascending - - - - - ingo_users_perm - - perm - ascending - - - - - -
- - - - ingo_spam - - - - - spam_owner - text - true - 255 - - - - spam_level - integer - 5 - false - 4 - - - - spam_folder - text - false - 255 - - - - ingo_spam_primary - true - - spam_owner - ascending - - - - - -
- - - - ingo_vacations - - - - - vacation_owner - text - true - 255 - - - - vacation_addresses - clob - false - - - - vacation_subject - text - false - 255 - - - - vacation_reason - clob - false - - - - vacation_days - integer - 7 - false - 4 - - - - vacation_excludes - clob - false - - - - vacation_ignorelists - integer - 1 - false - 4 - - - - vacation_start - integer - false - 4 - - - - vacation_end - integer - false - 4 - - - - ingo_vacations_primary - true - - vacation_owner - ascending - - - - - -
- -
diff --git a/ingo/scripts/upgrades/1.2.1_to_1.2.2.pgsql.sql b/ingo/scripts/upgrades/1.2.1_to_1.2.2.pgsql.sql deleted file mode 100644 index f8f9653ee..000000000 --- a/ingo/scripts/upgrades/1.2.1_to_1.2.2.pgsql.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE ingo_shares_groups ALTER group_uid TYPE VARCHAR(255); diff --git a/ingo/scripts/upgrades/1.2.1_to_1.2.2.sql b/ingo/scripts/upgrades/1.2.1_to_1.2.2.sql deleted file mode 100644 index 331e2ae79..000000000 --- a/ingo/scripts/upgrades/1.2.1_to_1.2.2.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE ingo_shares_groups CHANGE group_uid group_uid VARCHAR(255); diff --git a/ingo/scripts/upgrades/1.2_to_1.2.1.sql b/ingo/scripts/upgrades/1.2_to_1.2.1.sql deleted file mode 100644 index d5f6ac2c0..000000000 --- a/ingo/scripts/upgrades/1.2_to_1.2.1.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE ingo_shares CHANGE share_owner share_owner VARCHAR(255); -ALTER TABLE ingo_shares_users CHANGE user_uid user_uid VARCHAR(255); diff --git a/ingo/scripts/upgrades/2007-04-25_add_timed_vacation.sql b/ingo/scripts/upgrades/2007-04-25_add_timed_vacation.sql deleted file mode 100644 index 58abe3a4c..000000000 --- a/ingo/scripts/upgrades/2007-04-25_add_timed_vacation.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE ingo_vacations ADD vacation_start INT; -ALTER TABLE ingo_vacations ADD vacation_end INT; diff --git a/ingo/scripts/upgrades/2008-06-17_fix_varchar_lengths.sql b/ingo/scripts/upgrades/2008-06-17_fix_varchar_lengths.sql deleted file mode 100644 index d5f6ac2c0..000000000 --- a/ingo/scripts/upgrades/2008-06-17_fix_varchar_lengths.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE ingo_shares CHANGE share_owner share_owner VARCHAR(255); -ALTER TABLE ingo_shares_users CHANGE user_uid user_uid VARCHAR(255); diff --git a/ingo/scripts/upgrades/2008-09-23_fix_group_uid.sql b/ingo/scripts/upgrades/2008-09-23_fix_group_uid.sql deleted file mode 100644 index 331e2ae79..000000000 --- a/ingo/scripts/upgrades/2008-09-23_fix_group_uid.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE ingo_shares_groups CHANGE group_uid group_uid VARCHAR(255);