Problem/Motivation
Migrate's SqlBase class depends on global state - a hard-coded 'migrate' database connection which must be defined elsewhere (settings.php or explicit addConnectionInfo). This limits the flexibility of the class (for one thing, it means all migrations can only use the one connection, you can't have migrations from multiple databases), and could conflict with environments that define a 'migrate' connection for other reasons.
Proposed resolution
The class already supports a 'target' configuration key for the connection target - add 'key' for the connection key, and 'database' for a database info array to define the connection.
Remaining tasks
Submit the patch.
User interface changes
None.
API changes
Configuration additions:
- key - Connection key string, if omitted default to 'migrate' as today.
- database - A database information array as one would find in settings.php. If present, passed to Database::addConnectionInfo() to define the connection.
Comment | File | Size | Author |
---|---|---|---|
#1 | support_injection_of-2404397-1.patch | 3.74 KB | mikeryan |
Comments
Comment #1
mikeryanComment #2
mikeryanComment #3
mikeryanSee #2404401: Use dependency injection for the database connection for how we will use this in migrate_upgrade.
Comment #4
benjy CreditAttribution: benjy commentedLooks good to me.
Comment #5
alexpottMe too. Migrate changes are not frozen in beta. Committed d394fef and pushed to 8.0.x. Thanks!
This is not really a feature.