public function postUp() { $conn = Doctrine_Manager::connection(); $conn->export->createForeignKey('community', array('name' => 'community_FK_2', 'local' => 'community_category_id', 'foreign' => 'id', 'foreignTable' => 'community_category', 'onDelete' => 'SET NULL')); $conn->export->createIndex('community_category', 'community_category_I_1', array('fields' => array('lft_key' => array()))); $conn->export->createIndex('community_category', 'community_category_I_2', array('fields' => array('rht_key' => array()))); $conn->export->createIndex('community_category', 'community_category_I_3', array('fields' => array('tree_key' => array()))); $category = new CommunityCategory(); $category->setName('コミュニティカテゴリ'); $category->setIsAllowMemberCommunity(true); $category->save(); $treeKey = $category->getId(); $child = new CommunityCategory(); $child->setName('地域'); $child->setTreeKey($treeKey); $child->setIsAllowMemberCommunity(true); $child->save(); $child = new CommunityCategory(); $child->setName('グルメ'); $child->setTreeKey($treeKey); $child->setIsAllowMemberCommunity(true); $child->save(); $child = new CommunityCategory(); $child->setName('スポーツ'); $child->setTreeKey($treeKey); $child->setIsAllowMemberCommunity(true); $child->save(); }