Problem/Motivation
Unable to run drush migrate-status, drush migrate-import, etc. on drush 8.0.2 due to error:
Argument 1 passed to Drupal\migrate\Plugin\migrate\source\SqlBase::setUpDatabase() must be of the type array, null given, called in [error]
/xxx/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php on line 93 and
defined SqlBase.php:116
Drush command terminated abnormally due to an unrecoverable error. [error]
Drush 8.0.2 has started to trap error E_RECOVERABLE_ERROR and was not present in 8.0.1 where the commands work. Ref: https://github.com/drush-ops/drush/commit/a0e1f70c4e5b1c897f2952624da93c...
When database_state_key is set in the migration config, but does not exist in state (not sure if it should be/how it gets there), NULL is passed to SqlBase::setUpDatabase() but should be an array.
Relevant part from migrate config:
source:
plugin: d6_file
database_state_key: migrate_upgrade_6
Proposed resolution
Workaround:
./vendor/bin/drush --halt-on-error=0 migrate-status
To fix, an empty array should be passed instead of NULL if $this->state->get() fails.
Remaining tasks
Test to be written.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#7 | 2658282-migrate-drush-issue-7.patch | 979 bytes | iMiksu |
#2 | 2658282-migrate-drush-issue-2.patch | 890 bytes | andyrigby |
Comments
Comment #2
andyrigby CreditAttribution: andyrigby at Ixis - UK Drupal Support, Maintenance, Hosting and Development commentedAttached patch
Comment #3
nitro-hrishi CreditAttribution: nitro-hrishi as a volunteer commentedMoved to needs review
Comment #5
mikeryanWe should have a test for this situation.
Let's use short array syntax [].
Comment #7
iMiksuNow, using short array syntax [].
Comment #8
heddnClosing #2736789: Default of 'migration' database key is ONLY thing that works as duplicate.
Let's break that long thing into a separate line to make it more readable.
Comment #9
heddnAnd really, rather than passing an empty array, we should be falling through to the next conditionals. (In my opinion.) Or throwing loud errors that state is in a bad state (pun intended).
Comment #10
heddnPer conversation in IRC, closing as duplicate to #2700693: [meta] Make MigratePluginManager::getDefinitions() work cleanly with migrate_drupal enabled. This will be fixed as a result of work in that issue.