I made a task in the doctrine namespae called   :get-current-migration-
version
so i can do it from the command line:

lib/task/getCurrentMigrationVersionTask.class.php
<?php

class getCurrentMigrationVersionTask extends sfBaseTask
{
  protected function configure()
  {


    $this->addOptions(array(
      new sfCommandOption('application', null,
sfCommandOption::PARAMETER_REQUIRED, 'The application name'),
      new sfCommandOption('env', null,
sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
      new sfCommandOption('connection', null,
sfCommandOption::PARAMETER_REQUIRED, 'The connection name',
'doctrine'),
    ));

    $this->namespace        = 'doctrine';
    $this->name             = 'get-current-migration-version';
    $this->briefDescription = '';
    $this->detailedDescription = <<<EOF

  [php symfony getCurrentMigrationVersion|INFO]
EOF;
  }

  protected function execute($arguments = array(), $options = array())
  {
    // initialize the database connection
    $databaseManager = new sfDatabaseManager($this->configuration);
    $connection = $databaseManager->getDatabase($options
['connection'] ? $options['connection'] : null)->getConnection();

        //Todo make the path  bassed on an argument passed in
        $migration = new Doctrine_Migration('/Users/astoneham/dev/
sfprojects/voxcall/lib/migration');

        echo "Your current migration version is: ".$migration-
>getCurrentVersion();
        echo "\n";

  }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to