protected function execute($arguments = array(), $options = array())
    {
        $autoloader = sfSimpleAutoload::getInstance();
        $autoloader->addDirectory(sfConfig::get('sf_plugins_dir') . '/sfPropelMigrationsLightPlugin/lib');

        $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'],
                        $options['env'], true);

        $databaseManager = new sfDatabaseManager($configuration);

        $migrator = new sfMigrator;

        if (isset($arguments['schema-version']) && ctype_digit($arguments['schema-version'])) {
            $max = $arguments['schema-version'];
        } else {
            $max = $migrator->getMaxVersion();
        }

        $migrations = $migrator->getMigrationsToRunUpTo($max);

        foreach ($migrations as $migration) {
            echo "Marking as Migrated: $migration\n";
            $migrator->markMigration($migration);
        }
    }
function run_migrate($task, $args)
{
    if (count($args) == 0) {
        throw new Exception('You must provide a app.');
    }
    @(list($app, $env) = explode(':', $args[0]));
    if (!is_dir(sfConfig::get('sf_app_dir') . DIRECTORY_SEPARATOR . $app)) {
        throw new Exception('The app "' . $app . '" does not exist.');
    }
    // define constants
    define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));
    define('SF_APP', $app);
    define('SF_ENVIRONMENT', $env ? $env : 'cli');
    define('SF_DEBUG', true);
    // get configuration
    require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
    $databaseManager = new sfDatabaseManager();
    $databaseManager->initialize();
    $migrator = new sfMigrator();
    // if no other arguments besides app, then migrate to latest version
    if (count($args) == 1) {
        $runMigrationsCount = $migrator->migrate();
    } elseif (isset($args[1]) && ctype_digit($args[1])) {
        $runMigrationsCount = $migrator->migrate($args[1]);
    } else {
        throw new Exception('You can provide a destination migration number as a second parameter');
    }
    $currentVersion = $migrator->getCurrentVersion();
    pake_echo_action('migrations', 'migrated ' . $runMigrationsCount . ' step(s)');
    pake_echo_action('migrations', 'current database version: ' . $currentVersion);
}
 protected function execute($arguments = array(), $options = array())
 {
     $autoloader = sfSimpleAutoload::getInstance();
     $autoloader->addDirectory(sfConfig::get('sf_plugins_dir') . '/sfPropelMigrationsLightPlugin/lib');
     $migrator = new sfMigrator();
     if (!is_dir($migrator->getMigrationsDir())) {
         $this->getFilesystem()->mkDirs($migrator->getMigrationsDir());
     }
     $this->logSection('migrations', 'generating new migration stub');
     $filename = $migrator->generateMigration($arguments['name']);
     $this->logSection('file+', $filename);
 }
 protected function execute($arguments = array(), $options = array())
 {
     $autoloader = sfSimpleAutoload::getInstance();
     $autoloader->addDirectory(sfConfig::get('sf_plugins_dir') . '/sfPropelMigrationsLightPlugin/lib');
     $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true);
     $databaseManager = new sfDatabaseManager($configuration);
     $migrator = new sfMigrator();
     if (isset($arguments['schema-version']) && ctype_digit($arguments['schema-version'])) {
         $runMigrationsCount = $migrator->migrate((int) $arguments['schema-version']);
     } else {
         $runMigrationsCount = $migrator->migrate();
     }
     $currentVersion = $migrator->getCurrentVersion();
     $this->logSection('migrations', 'migrated ' . $runMigrationsCount . ' step(s)');
     $this->logSection('migrations', 'current database version: ' . $currentVersion);
 }
 /**
  * Execute a SQL query.
  *
  * @param   string $sql The SQL statement.
  * @param   double $fetchmode
  *
  * @return  mixed
  */
 protected function executeQuery($sql, $fetchmode = null)
 {
   return sfMigrator::executeQuery($sql, $fetchmode);
 }