From 6d2e2cf77674ba1dda28fcbe9c01e2a9745a5130 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Fri, 28 Jan 2011 18:05:33 +0100 Subject: [PATCH] Convert Horde_Prefs to migrations. --- .../Horde/Prefs/1_horde_prefs_base_tables.php | 22 ++++++++++++++++++++++ horde/scripts/sql/horde_prefs.mssql.sql | 11 ----------- horde/scripts/sql/horde_prefs.pgsql.sql | 11 ----------- horde/scripts/sql/horde_prefs.sql | 11 ----------- .../2005-09-22_horde_prefs_varchar2.oci8.sql | 9 --------- .../upgrades/2006-06-29_horde_prefs_indexes.sql | 6 ------ 6 files changed, 22 insertions(+), 48 deletions(-) create mode 100644 framework/Prefs/migration/Horde/Prefs/1_horde_prefs_base_tables.php delete mode 100644 horde/scripts/sql/horde_prefs.mssql.sql delete mode 100644 horde/scripts/sql/horde_prefs.pgsql.sql delete mode 100644 horde/scripts/sql/horde_prefs.sql delete mode 100644 horde/scripts/upgrades/2005-09-22_horde_prefs_varchar2.oci8.sql delete mode 100644 horde/scripts/upgrades/2006-06-29_horde_prefs_indexes.sql diff --git a/framework/Prefs/migration/Horde/Prefs/1_horde_prefs_base_tables.php b/framework/Prefs/migration/Horde/Prefs/1_horde_prefs_base_tables.php new file mode 100644 index 000000000..2c85f3ce7 --- /dev/null +++ b/framework/Prefs/migration/Horde/Prefs/1_horde_prefs_base_tables.php @@ -0,0 +1,22 @@ +tables())) { + $t = $this->createTable('horde_prefs', array('primaryKey' => array('pref_uid', 'pref_scope', 'pref_name'))); + $t->column('pref_uid', 'string', array('limit' => 255, 'null' => false)); + $t->column('pref_scope', 'string', array('limit' => 16, 'null' => false, 'default' => '')); + $t->column('pref_name', 'string', array('limit' => 32, 'null' => false)); + $t->column('pref_value', 'text'); + $t->end(); + $this->addIndex('horde_prefs', array('pref_uid')); + $this->addIndex('horde_prefs', array('pref_scope')); + } + } + + public function down() + { + $this->dropTable('horde_prefs'); + } +} diff --git a/horde/scripts/sql/horde_prefs.mssql.sql b/horde/scripts/sql/horde_prefs.mssql.sql deleted file mode 100644 index d09c025a0..000000000 --- a/horde/scripts/sql/horde_prefs.mssql.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE horde_prefs ( - pref_uid VARCHAR(255) NOT NULL, - pref_scope VARCHAR(16) DEFAULT '' NOT NULL, - pref_name VARCHAR(32) NOT NULL, - pref_value VARCHAR(MAX), --- - PRIMARY KEY (pref_uid, pref_scope, pref_name) -); - -CREATE INDEX pref_uid_idx ON horde_prefs (pref_uid); -CREATE INDEX pref_scope_idx ON horde_prefs (pref_scope); diff --git a/horde/scripts/sql/horde_prefs.pgsql.sql b/horde/scripts/sql/horde_prefs.pgsql.sql deleted file mode 100644 index 2103f56e4..000000000 --- a/horde/scripts/sql/horde_prefs.pgsql.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE horde_prefs ( - pref_uid VARCHAR(255) NOT NULL, - pref_scope VARCHAR(16) DEFAULT '' NOT NULL, - pref_name VARCHAR(32) NOT NULL, - pref_value BYTEA, --- - PRIMARY KEY (pref_uid, pref_scope, pref_name) -); - -CREATE INDEX pref_uid_idx ON horde_prefs (pref_uid); -CREATE INDEX pref_scope_idx ON horde_prefs (pref_scope); diff --git a/horde/scripts/sql/horde_prefs.sql b/horde/scripts/sql/horde_prefs.sql deleted file mode 100644 index 3fef85435..000000000 --- a/horde/scripts/sql/horde_prefs.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE horde_prefs ( - pref_uid VARCHAR(255) NOT NULL, - pref_scope VARCHAR(16) DEFAULT '' NOT NULL, - pref_name VARCHAR(32) NOT NULL, - pref_value TEXT, --- - PRIMARY KEY (pref_uid, pref_scope, pref_name) -); - -CREATE INDEX pref_uid_idx ON horde_prefs (pref_uid); -CREATE INDEX pref_scope_idx ON horde_prefs (pref_scope); diff --git a/horde/scripts/upgrades/2005-09-22_horde_prefs_varchar2.oci8.sql b/horde/scripts/upgrades/2005-09-22_horde_prefs_varchar2.oci8.sql deleted file mode 100644 index d67ac747b..000000000 --- a/horde/scripts/upgrades/2005-09-22_horde_prefs_varchar2.oci8.sql +++ /dev/null @@ -1,9 +0,0 @@ --- Use this script to convert CHAR columns in horde_prefs to VARCHAR2 and trim --- the space padding. This is only necessary if horde_prefs was created using --- scripts/sql/create.oci8.sql -ALTER TABLE horde_prefs MODIFY pref_uid VARCHAR2(255); -ALTER TABLE horde_prefs MODIFY pref_scope VARCHAR2(16); -ALTER TABLE horde_prefs MODIFY pref_name VARCHAR2(32); -UPDATE horde_prefs SET pref_uid = RTRIM(pref_uid); -UPDATE horde_prefs SET pref_scope = RTRIM(pref_scope); -UPDATE horde_prefs SET pref_name = RTRIM(pref_name); diff --git a/horde/scripts/upgrades/2006-06-29_horde_prefs_indexes.sql b/horde/scripts/upgrades/2006-06-29_horde_prefs_indexes.sql deleted file mode 100644 index 17f9ac2f2..000000000 --- a/horde/scripts/upgrades/2006-06-29_horde_prefs_indexes.sql +++ /dev/null @@ -1,6 +0,0 @@ --- This script adds additional indexes to the horde_prefs table that should --- improve loading of preferences from the preference table. - -CREATE INDEX pref_uid_idx ON horde_prefs (pref_uid); -CREATE INDEX pref_scope_idx ON horde_prefs (pref_scope); - -- 2.11.0