migrations icon indicating copy to clipboard operation
migrations copied to clipboard

`migrations-db.php` is no longer used in 3.0

Open duncan3dc opened this issue 5 years ago • 1 comments

BC Break Report

Q A
BC Break yes
Version 3.0.0

Summary

We use migrations-db.php to run our migrations against a different database than the one specified in cli-config.php. This migrations-db.php file is no longer used.

Previous behavior

In 2.2.1 the migrations-db.php file was used and the migrations ran against the database specified in there

Current behavior

In 3.0.1 the migrations-db.php file is ignored and our migrations run against the database from cli-config.php

How to reproduce

  • Create a cli-config.php for database1, then a migrations-db.php for database2
  • Run a command that interacts with the database
  • Check which database the command was actually executed against

I did poke around a little to try and propose a PR, but I'm not familiar enough with the dependency factory changes to propose a change. It looks like dfd4286062cb601e3818428201f21547f07e79c6 was targetting a similar issue, concerning a different configuration file.

duncan3dc avatar Sep 21 '20 19:09 duncan3dc

We've also stumbled across this Problem. We intend to execute the migrations as a different user to be able to limit the rights of the Doctrine ORM DB-User. But this does not seem possible right now.

I'd be willing to work on a PR.

I would add a setConnectionLoader-Method to DependencyFactory, similar to setConfigurationLoader. But the getConnection()-Function always prefers the EntityManager-Connection. I would handle this with a flag. Any thoughts on this?

mkrauser avatar Sep 23 '22 10:09 mkrauser