title: symfony2: multiple DB connections / entity managers with doctrine migrations & schema_filter
body: <p>I currently have a single database / entity manager symfony2 (2.1) app working just fine, including doctrine migrations. I am in the process of adding a second database connection + entity manager and am having trouble getting doctrine migrations to do what I want.</p>
  
  <p>Essentially, I want most of my entities to live in my first, 'default' database, and have several new entities / tables in my second database - and then have doctrine migrations manage any changes to the schemas. The documentation seems to imply you can set a 'schema_filter' on the connection to achieve this.</p>
  
  <p>(The use case is this: there are several installs of our app for white-labelled resellers, each with their own primary database. However, we are implementing interactive help, which will be written by us in a CMS / blog type interface and available, via this second database, to all installs.)</p>
  
  <p>So far my doctrine configuration looks like this (from app/config/config.yml):</p>
  
  <pre><code>    dbal:
          default:
              driver:   %database_driver%
              host:     %database_host%
              port:     %database_port%
              dbname:   %database_name%
              user:     %database_user%
              password: %database_password%
              charset:  UTF8
              schema_filter: ~^(?!help_)~
          cross_site:
              driver:   %crossite_database_driver%
              host:     %crossite_database_host%
              port:     %crossite_database_port%
              dbname:   %crossite_database_name%
              user:     %crossite_database_user%
              password: %crossite_database_password%
              charset:  UTF8
              schema_filter: ~^help_~
  
  orm:
      auto_generate_proxy_classes: %kernel.debug%
      default_entity_manager: default
      entity_managers:
          default:
              connection: default
              mappings:
                  &lt;most of the bundles&gt;
          help:
              connection: cross_site
              mappings:
                  HelpBundle: ~
  </code></pre>
  
  <p>The intention is to have most of the entities / tables in the 'default' database, but <strong>exclude</strong> any table beginning with 'help_'. Conversely, the second database should contain <strong>only</strong> those tables beginning with 'help_'.</p>
  
  <p>However, whenever I run a doctrine migration using either entity manager, it will simply include all tables regardless of their name.</p>
  
  <pre><code>php app/console doctrine:migrations:migrate # includes every table including help_*
  php app/console doctrine:migrations:migrate --em="help" # includes every table
  </code></pre>
  
  <p>Am I mis-using schema_filter? Is there another way to achieve my goal?</p>
  
  <p><strong>Update:</strong> It's actually worse... after the first migration using the 'help' entity manager, I am no longer able to run additional migrations using --em="help"; I receive this error:</p>
  
  <pre><code>SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'migration_versions' already exists 
  </code></pre>
  
  <p>Migrations on the original EM continue to work fine. Help?</p>