public function fake($module = null, $to = null) { if (null === $to && Core_Migration_Manager::isMigration($module)) { list($to, $module) = array($module, null); } require_once 'bootstrap.php'; $this->getManager()->fake($module, $to); foreach ($this->getManager()->getMessages() as $message) { $this->message($message, 'hiGreen'); } }
/** * Migrations Action */ public function migrationsAction() { $config = $this->_store->config->production->resources->db; $db = Zend_Db::factory($config); Zend_Db_Table_Abstract::setDefaultAdapter($db); $options = array('projectDirectoryPath' => APPLICATION_PATH . '/..', 'modulesDirectoryPath' => APPLICATION_PATH . '/modules'); $manager = new Core_Migration_Manager($options); $manager->up(); $pathToModules = APPLICATION_PATH . '/modules/'; foreach ($this->_store->modules as $module => $value) { //up installed modules migrations if ($value === false) { $pathToModule = $pathToModules . $module; if (is_dir($pathToModules) && is_writable($pathToModules) && is_dir($pathToModule)) { rename($pathToModule, APPLICATION_PATH . '/modules/.' . $module); } } else { $manager->up($module); if ($module === 'menu') { $this->_store->config->production->resources->navigation->source->default = 'db'; } } } unset($this->_store->modules); $usersTable = new Users_Model_User_Table(); //update or create admin if (!$usersTable->update($this->_store->user, 'login = "******"')) { $usersTable->insert($this->_store->user); } unset($this->_store->user); $this->_helper->flashMessenger('Migrations rolled up'); $this->_store->progress['install-index-migrations'] = true; $this->_helper->redirector('index'); $this->view->currentPage = 'install-index-migrations'; }
/** * Migrations * * @param bool $up * @param null $module * @param null $migration */ public static function migration($up = true, $module = null, $migration = null) { require_once 'Core/Migration/Manager.php'; if (null === $migration && Core_Migration_Manager::isMigration($module)) { list($migration, $module) = array($module, null); } $manager = new Core_Migration_Manager(array('projectDirectoryPath' => APPLICATION_PATH . '/../', 'modulesDirectoryPath' => APPLICATION_PATH . '/modules/', 'migrationsDirectoryName' => 'migrations')); if ($up) { $manager->up($module, $migration); } else { $manager->down($module, $migration); } foreach ($manager->getMessages() as $message) { echo $message . "\n"; } }
public function testSetProjectDirectoryPath() { $manager = new Core_Migration_Manager(); $manager->setProjectDirectoryPath('/test/path'); $this->assertEquals('/test/path', $manager->getProjectDirectoryPath()); }