title: Doctrine2 Symfony2 migration on multiple databases
body: <p>I'm having a bit of trouble doing a db migration on a non-default database with Symfony2 and Doctrine.</p>
  
  <p>I have two dbs and two entity managers I'm working with. I have two bundles, each which works with that respective EM so everything should be quite separated.</p>
  
  <p>Under my DefaultBundle I have migrations with about 20 migration files that all apply to the default db. My SecondBundle has one migration file which applies to the seconddb.</p>
  
  <p>When I attempt to run</p>
  
  <pre><code>   php app/console doctrine:migrations:migrate --no-interaction --em="second"
  </code></pre>
  
  <p>I'm getting</p>
  
  <pre><code>Migration 20140709212101 failed during Execution. Error There is no table with name 'second_database.users' in the schema.
  
    [Doctrine\DBAL\Schema\SchemaException]                                  
    There is no table with name 'second_database.users' in the schema.  
  </code></pre>
  
  <p>Which is totally true, "users" is a table in my primary db. What's happening here is that the migration file it's attempting to run is actually the first of the 20 in the DefaultCore (which are all old and already applied). Because I've specified --em it's crossing migrations I want don't want to run with against the db I'm working with. There doesn't appear to be another commmand line option to specify a bundle like there is for other migration commands like generate. I want to ignore DefaultBundle, and just run my migrations from my SecondBundle.</p>