public function setUp() { $factory_db = new Horde_Test_Factory_Db(); $this->db = $factory_db->create(); $this->mapper = new Horde_Rdo_Test_Objects_SimpleMapper($this->db); $migration = new Horde_Db_Migration_Base($this->db); try { $migration->dropTable('horde_rdo_test'); } catch (Horde_Db_Exception $e) { } $t = $migration->createTable('horde_rdo_test', array('autoincrementKey' => 'id')); $t->column('intprop', 'integer'); $t->column('textprop', 'string'); $t->end(); $migration->migrate('up'); }
function migrate_sql($db) { $migration = new Horde_Db_Migration_Base($db); /* Cleanup potential left-overs. */ try { $migration->dropTable('test_shares'); $migration->dropTable('test_shares_groups'); $migration->dropTable('test_shares_users'); } catch (Horde_Db_Exception $e) { } $t = $migration->createTable('test_shares', array('autoincrementKey' => 'share_id')); $t->column('share_name', 'string', array('limit' => 255, 'null' => false)); $t->column('share_owner', 'string', array('limit' => 255)); $t->column('share_parents', 'string', array('limit' => 4000)); $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)); $t->column('attribute_desc', 'string', array('limit' => 255)); $t->column('attribute_clob', 'text'); $t->end(); $migration->addIndex('test_shares', array('share_name')); $migration->addIndex('test_shares', array('share_owner')); $migration->addIndex('test_shares', array('perm_creator')); $migration->addIndex('test_shares', array('perm_default')); $migration->addIndex('test_shares', array('perm_guest')); $t = $migration->createTable('test_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(); $migration->addIndex('test_shares_groups', array('share_id')); $migration->addIndex('test_shares_groups', array('group_uid')); $migration->addIndex('test_shares_groups', array('perm')); $t = $migration->createTable('test_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(); $migration->addIndex('test_shares_users', array('share_id')); $migration->addIndex('test_shares_users', array('user_uid')); $migration->addIndex('test_shares_users', array('perm')); $migration->migrate('up'); }
protected static function _migrate_sql_rdo($db) { $migration = new Horde_Db_Migration_Base($db); /* Cleanup potential left-overs. */ try { $migration->dropTable('test_someeagerbaseobjects'); $migration->dropTable('test_somelazybaseobjects'); $migration->dropTable('test_relatedthings'); $migration->dropTable('test_manytomanya'); $migration->dropTable('test_manytomanyb'); $migration->dropTable('test_manythrough'); } catch (Horde_Db_Exception $e) { } $t = $migration->createTable('test_someeagerbaseobjects', array('autoincrementKey' => 'baseobject_id')); $t->column('relatedthing_id', 'integer'); $t->column('atextproperty', 'string'); $t->end(); $t = $migration->createTable('test_somelazybaseobjects', array('autoincrementKey' => 'baseobject_id')); $t->column('relatedthing_id', 'integer'); $t->column('atextproperty', 'string'); $t->end(); $t = $migration->createTable('test_relatedthings', array('autoincrementKey' => 'relatedthing_id')); $t->column('relatedthing_textproperty', 'string', array('limit' => 255, 'null' => false)); $t->column('relatedthing_intproperty', 'integer', array('null' => false)); $t->end(); $t = $migration->createTable('test_manytomanya', array('autoincrementKey' => 'a_id')); $t->column('a_intproperty', 'integer', array('null' => false)); $t->end(); $t = $migration->createTable('test_manytomanyb', array('autoincrementKey' => 'b_id')); $t->column('b_intproperty', 'integer', array('null' => false)); $t->end(); $t = $migration->createTable('test_manythrough'); $t->column('a_id', 'integer'); $t->column('b_id', 'integer'); $t->end(); $migration->migrate('up'); }