From: Jan Schneider Date: Fri, 28 Jan 2011 16:49:20 +0000 (+0100) Subject: Convert Horde_VFS to migrations. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=aa341ee736454981807dc196fd1c5d1b6c7802f0;p=horde.git Convert Horde_VFS to migrations. --- diff --git a/framework/VFS/migration/Horde/VFS/1_horde_vfs_base_tables.php b/framework/VFS/migration/Horde/VFS/1_horde_vfs_base_tables.php new file mode 100644 index 000000000..928aeb0ac --- /dev/null +++ b/framework/VFS/migration/Horde/VFS/1_horde_vfs_base_tables.php @@ -0,0 +1,40 @@ +tables())) { + $t = $this->createTable('horde_vfs', array('primaryKey' => array('vfs_id'))); + $t->column('vfs_id', 'int', array('null' => false, 'unsigned' => true)); + $t->column('vfs_type', 'smallint', array('null' => false, 'unsigned' => true)); + $t->column('vfs_path', 'string', array('limit' => 255, 'null' => false)); + $t->column('vfs_name', 'string', array('limit' => 255, 'null' => false)); + $t->column('vfs_modified', 'bigint', array('null' => false)); + $t->column('vfs_owner', 'string', array('limit' => 255, 'null' => false)); + $t->column('vfs_data', 'binary'); + $t->end(); + $this->addIndex('horde_vfs', array('vfs_path')); + $this->addIndex('horde_vfs', array('vfs_name')); + } + if (!in_array('horde_muvfs', $this->tables())) { + $t = $this->createTable('horde_muvfs', array('primaryKey' => array('vfs_id'))); + $t->column('vfs_id', 'int', array('null' => false, 'unsigned' => true)); + $t->column('vfs_type', 'smallint', array('null' => false, 'unsigned' => true)); + $t->column('vfs_path', 'string', array('limit' => 255, 'null' => false)); + $t->column('vfs_name', 'string', array('limit' => 255, 'null' => false)); + $t->column('vfs_modified', 'bigint', array('null' => false)); + $t->column('vfs_owner', 'string', array('limit' => 255, 'null' => false)); + $t->column('vfs_perms', 'smallint', array('null' => false, 'unsigned' => true)); + $t->column('vfs_data', 'binary'); + $t->end(); + $this->addIndex('horde_muvfs', array('vfs_path')); + $this->addIndex('horde_muvfs', array('vfs_name')); + } + } + + public function down() + { + $this->dropTable('horde_muvfs'); + $this->dropTable('horde_vfs'); + } +} diff --git a/framework/VFS/migration/Horde/VFS/2_horde_vfs_upgrade_autoincrement.php b/framework/VFS/migration/Horde/VFS/2_horde_vfs_upgrade_autoincrement.php new file mode 100644 index 000000000..b4cf60d60 --- /dev/null +++ b/framework/VFS/migration/Horde/VFS/2_horde_vfs_upgrade_autoincrement.php @@ -0,0 +1,15 @@ +changeColumn('horde_vfs', 'vfs_id', 'integer', array('null' => false, 'unsigned' => true, 'default' => null, 'autoincrement' => true)); + $this->changeColumn('horde_muvfs', 'vfs_id', 'integer', array('null' => false, 'unsigned' => true, 'default' => null, 'autoincrement' => true)); + } + + public function down() + { + $this->changeColumn('horde_muvfs', 'vfs_id', 'integer', array('null' => false, 'unsigned' => true)); + $this->changeColumn('horde_vfs', 'vfs_id', 'integer', array('null' => false, 'unsigned' => true)); + } +} \ No newline at end of file diff --git a/horde/scripts/sql/horde_muvfs.mssql.sql b/horde/scripts/sql/horde_muvfs.mssql.sql deleted file mode 100644 index 4a8e054c4..000000000 --- a/horde/scripts/sql/horde_muvfs.mssql.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE horde_muvfs ( - vfs_id INT UNSIGNED NOT NULL, - vfs_type SMALLINT UNSIGNED NOT NULL, - vfs_path VARCHAR(255) NOT NULL, - vfs_name VARCHAR(255) NOT NULL, - vfs_modified BIGINT NOT NULL, - vfs_owner VARCHAR(255) NOT NULL, - vfs_perms SMALLINT UNSIGNED NOT NULL, - vfs_data VARBINARY(MAX), - PRIMARY KEY (vfs_id) -); - -CREATE INDEX vfs_path_idx ON horde_muvfs (vfs_path); -CREATE INDEX vfs_name_idx ON horde_muvfs (vfs_name); diff --git a/horde/scripts/sql/horde_muvfs.sql b/horde/scripts/sql/horde_muvfs.sql deleted file mode 100644 index 134398c48..000000000 --- a/horde/scripts/sql/horde_muvfs.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE horde_muvfs ( - vfs_id INT UNSIGNED NOT NULL, - vfs_type SMALLINT UNSIGNED NOT NULL, - vfs_path VARCHAR(255) NOT NULL, - vfs_name VARCHAR(255) NOT NULL, - vfs_modified BIGINT NOT NULL, - vfs_owner VARCHAR(255) NOT NULL, - vfs_perms SMALLINT UNSIGNED NOT NULL, - vfs_data LONGBLOB, --- Or, on some DBMS systems: --- vfs_data IMAGE, - PRIMARY KEY (vfs_id) -); - -CREATE INDEX vfs_path_idx ON horde_muvfs (vfs_path); -CREATE INDEX vfs_name_idx ON horde_muvfs (vfs_name); diff --git a/horde/scripts/sql/horde_vfs.mssql.sql b/horde/scripts/sql/horde_vfs.mssql.sql deleted file mode 100644 index 5524b5c36..000000000 --- a/horde/scripts/sql/horde_vfs.mssql.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE horde_vfs ( - vfs_id INT UNSIGNED NOT NULL, - vfs_type SMALLINT UNSIGNED NOT NULL, - vfs_path VARCHAR(255) NOT NULL, - vfs_name VARCHAR(255) NOT NULL, - vfs_modified BIGINT NOT NULL, - vfs_owner VARCHAR(255) NOT NULL, - vfs_data VARBINARY(MAX), - PRIMARY KEY (vfs_id) -); - -CREATE INDEX vfs_path_idx ON horde_vfs (vfs_path); -CREATE INDEX vfs_name_idx ON horde_vfs (vfs_name); diff --git a/horde/scripts/sql/horde_vfs.oci8.sql b/horde/scripts/sql/horde_vfs.oci8.sql deleted file mode 100644 index 4d96caee7..000000000 --- a/horde/scripts/sql/horde_vfs.oci8.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE horde_vfs ( - vfs_id NUMBER(16) NOT NULL, - vfs_type NUMBER(8) NOT NULL, - vfs_path VARCHAR2(255), - vfs_name VARCHAR2(255) NOT NULL, - vfs_modified NUMBER(16) NOT NULL, - vfs_owner VARCHAR2(255), - vfs_data BLOB, --- - PRIMARY KEY (vfs_id) -); - -CREATE INDEX vfs_path_idx ON horde_vfs (vfs_path); -CREATE INDEX vfs_name_idx ON horde_vfs (vfs_name); diff --git a/horde/scripts/sql/horde_vfs.pgsql.sql b/horde/scripts/sql/horde_vfs.pgsql.sql deleted file mode 100644 index afecb0b9a..000000000 --- a/horde/scripts/sql/horde_vfs.pgsql.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE horde_vfs ( - vfs_id INT NOT NULL, - vfs_type SMALLINT NOT NULL, - vfs_path VARCHAR(255) NOT NULL, - vfs_name VARCHAR(255) NOT NULL, - vfs_modified BIGINT NOT NULL, - vfs_owner VARCHAR(255) NOT NULL, - vfs_data TEXT, - - PRIMARY KEY (vfs_id) -); - -CREATE INDEX vfs_path_idx ON horde_vfs (vfs_path); -CREATE INDEX vfs_name_idx ON horde_vfs (vfs_name); diff --git a/horde/scripts/sql/horde_vfs.sql b/horde/scripts/sql/horde_vfs.sql deleted file mode 100644 index 1aa8e5609..000000000 --- a/horde/scripts/sql/horde_vfs.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE horde_vfs ( - vfs_id INT UNSIGNED NOT NULL, - vfs_type SMALLINT UNSIGNED NOT NULL, - vfs_path VARCHAR(255) NOT NULL, - vfs_name VARCHAR(255) NOT NULL, - vfs_modified BIGINT NOT NULL, - vfs_owner VARCHAR(255) NOT NULL, - vfs_data LONGBLOB, --- Or, on some DBMS systems: --- vfs_data IMAGE, - PRIMARY KEY (vfs_id) -); - -CREATE INDEX vfs_path_idx ON horde_vfs (vfs_path); -CREATE INDEX vfs_name_idx ON horde_vfs (vfs_name);