Problem/Motivation

If for some reason a db connection cannot be located, there is a fallback on a global default of 'migrate'. But if that doesn't exist, then really nasty errors start spewing from migrate.

$ drush mi --update d6_user_picture_file
Drupal\Core\Database\ConnectionNotDefinedException: The specified database connection is not defined: migrate in                                        [error]
/app/web/core/lib/Drupal/Core/Database/Database.php:361
Stack trace:
#0 /app/web/core/lib/Drupal/Core/Database/Database.php(166): Drupal\Core\Database\Database::openConnection('migrate', 'default')
#1 /app/web/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php(130): Drupal\Core\Database\Database::getConnection('default', 'migrate')
#2 /app/web/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php(93): Drupal\migrate\Plugin\migrate\source\SqlBase->setUpDatabase(Array)
#3 /app/web/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php(138): Drupal\migrate\Plugin\migrate\source\SqlBase->getDatabase()
#4 /app/web/core/modules/node/src/Plugin/migrate/source/d6/NodeType.php(42): Drupal\migrate\Plugin\migrate\source\SqlBase->select('node_type', 't')
#5 /app/web/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php(148): Drupal\node\Plugin\migrate\source\d6\NodeType->query()
#6 /app/web/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php(163): Drupal\migrate\Plugin\migrate\source\SqlBase->prepareQuery()
#7 /app/web/core/modules/node/src/Plugin/migrate/source/d6/NodeType.php(90): Drupal\migrate\Plugin\migrate\source\SqlBase->initializeIterator()
#8 /app/web/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php(228):
Drupal\node\Plugin\migrate\source\d6\NodeType->initializeIterator()
#9 /app/web/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php(270):
Drupal\migrate\Plugin\migrate\source\SourcePluginBase->getIterator()
#10 /app/web/core/modules/node/src/Plugin/migrate/D6NodeDeriver.php(92): Drupal\migrate\Plugin\migrate\source\SourcePluginBase->rewind()
#11 /app/web/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(100):

Proposed resolution

Figure out a better way to inform the user that an available db connection for sucking in data from a previous version of Drupal doesn't exist.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

heddn created an issue. See original summary.

mikeryan’s picture

Yes, I was never fond of a builtin global default here. fallback_state_key is also problematic, the getDatabase() and setUpDatabase() logic needs a close look.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mikeryan’s picture