本文整理汇总了PHP中Migration::sync_migration_files方法的典型用法代码示例。如果您正苦于以下问题:PHP Migration::sync_migration_files方法的具体用法?PHP Migration::sync_migration_files怎么用?PHP Migration::sync_migration_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Migration
的用法示例。
在下文中一共展示了Migration::sync_migration_files方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _execute
/**
* Migrates the database to the version specified
*
* @param array $options Configuration to use
*/
protected function _execute(array $options)
{
$groups = $options['group'];
$target = $options['to'];
$dry_run = $options['dry-run'] !== FALSE;
$quiet = $options['quiet'] !== FALSE;
$up = $options['up'] !== FALSE;
$down = $options['down'] !== FALSE;
$groups = $this->_parse_groups($groups);
if ($target === NULL) {
if ($down) {
$target = FALSE;
} else {
$target = TRUE;
}
}
$model = new Model_Migration();
$model->ensure_table_exists();
$manager = new Migration(NULL, $model);
// Sync the available migrations with those in the db
$manager->sync_migration_files()->set_dry_run($dry_run);
try {
// Run migrations for specified groups & versions
$manager->run_migration($groups, $target);
} catch (Migration_Exception $e) {
echo View::factory('minion/db/exception')->set('migration', $e->get_migration())->set('error', $e->getMessage());
throw $e;
}
$view = View::factory('minion/db/run')->set('dry_run', $dry_run)->set('quiet', $quiet)->set('dry_run_sql', $manager->get_dry_run_sql())->set('executed_migrations', $manager->get_executed_migrations())->set('group_versions', $model->get_group_statuses());
return $view;
}