I have 2 databases db1 and db2 in symfony2 + doctrine2 and both databases are different from each other in terms of tables and their fields.
I need to work on migration. Things work fine as long as there is one database.
But it does not works when there are more than one databases.
Also, is there any way where I can provide entity manager specific migration settings.
Or is there any way through which I can provide connection or entity manager in the migration class.
You can provide an entityManager using --em=name option in the migration task. I also add this piece of code, to avoid executing of the migration on another db by mistake:
$parameters = $this->connection->getParams();
$this->skipIf(
$parameters['dbname'] != "my_db_name"
'This is the other DB\'s migration, pass a correct --em parameter'
);
I haven't found any other way to check the EM, so I can't help you if your databases have same names.
Also note, that you should add the skipIf to all your migrations, so you can migrate without worry in both you databases.