#StackBounty: #8 #drush #migration Database error when execute drush migrate:status

Bounty: 150

I’m trying to do a ‘file to media’ migration on a d8 installation. Following the readme on the module I have created a custom module and created the two yaml files. After enabling the module and drush ms i get the following error:

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed

The error appears on my local (DDEV) and my production environment. Drush works otherwise. drush sql-cli works.

I think i’m missing something. Do i have to set a database reference somewhere?
Happy to provide additional information when needed, as i’m clueless atm.

Thanks for pointing me in the right direction.

Edit:
output of drush ms -v

Exception trace:
  at myproject/docroot/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php:416
 PDO->__construct() at myproject/docroot/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php:416
 DrupalCoreDatabaseDrivermysqlConnection::open() at myproject/docroot/core/lib/Drupal/Core/Database/Database.php:374
 DrupalCoreDatabaseDatabase::openConnection() at myproject/docroot/core/lib/Drupal/Core/Database/Database.php:169
 DrupalCoreDatabaseDatabase::getConnection() at myproject/docroot/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php:201
 DrupalmigratePluginmigratesourceSqlBase->setUpDatabase() at myproject/docroot/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php:154
 DrupalmigratePluginmigratesourceSqlBase->getDatabase() at myproject/docroot/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php:221
 DrupalmigratePluginmigratesourceSqlBase->checkRequirements() at myproject/docroot/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php:112
 Drupalmigrate_drupalPluginmigratesourceDrupalSqlBase->checkRequirements() at myproject/docroot/modules/contrib/metatag/src/Plugin/migrate/source/d7/MetatagFieldInstanceDeriver.php:69
 DrupalmetatagPluginmigratesourced7MetatagFieldInstanceDeriver->getDerivativeDefinitions() at myproject/docroot/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php:101
 DrupalComponentPluginDiscoveryDerivativeDiscoveryDecorator->getDerivatives() at myproject/docroot/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php:87
 DrupalComponentPluginDiscoveryDerivativeDiscoveryDecorator->getDefinitions() at myproject/docroot/core/modules/migrate/src/Plugin/MigrationPluginManager.php:262
 DrupalmigratePluginMigrationPluginManager->findDefinitions() at myproject/docroot/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php:175
 DrupalCorePluginDefaultPluginManager->getDefinitions() at myproject/docroot/core/modules/migrate/src/Plugin/MigrationPluginManager.php:109
 DrupalmigratePluginMigrationPluginManager->createInstances() at myproject/docroot/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php:697
 Drupalmigrate_toolsCommandsMigrateToolsCommands->migrationsList() at myproject/docroot/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php:135
 Drupalmigrate_toolsCommandsMigrateToolsCommands->status() at n/a:n/a
 call_user_func_array() at myproject/vendor/consolidation/annotated-command/src/CommandProcessor.php:257
 ConsolidationAnnotatedCommandCommandProcessor->runCommandCallback() at myproject/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
 ConsolidationAnnotatedCommandCommandProcessor->validateRunAndAlter() at myproject/vendor/consolidation/annotated-command/src/CommandProcessor.php:176
 ConsolidationAnnotatedCommandCommandProcessor->process() at myproject/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:302
 ConsolidationAnnotatedCommandAnnotatedCommand->execute() at myproject/vendor/symfony/console/Command/Command.php:255
 SymfonyComponentConsoleCommandCommand->run() at myproject/vendor/symfony/console/Application.php:1005
 SymfonyComponentConsoleApplication->doRunCommand() at myproject/vendor/symfony/console/Application.php:255
 SymfonyComponentConsoleApplication->doRun() at myproject/vendor/symfony/console/Application.php:148
 SymfonyComponentConsoleApplication->run() at myproject/vendor/drush/drush/src/Runtime/Runtime.php:118
 DrushRuntimeRuntime->doRun() at myproject/vendor/drush/drush/src/Runtime/Runtime.php:49
 DrushRuntimeRuntime->run() at myproject/vendor/drush/drush/drush.php:72
 require() at myproject/vendor/drush/drush/includes/preflight.inc:18
 drush_main() at phar:///usr/local/bin/drush/bin/drush.php:143
 require() at /usr/local/bin/drush:10


Get this bounty!!!

#StackBounty: #migration how to migrate multiple taxonomy terms with entity lookup plugin

Bounty: 300

Im using the code below to migrate a taxonomy term with multiple values and I get this error below. is there a way to migrate multiple taxonomy terms with this plugin? :

InvalidArgumentException: Placeholders must have a trailing [] if they
are to be expanded with an array of values. in [error]
/var/www/html/docroot/core/lib/Drupal/Core/Database/Connection.php:744

field_states_operating_in:
    - plugin: entity_lookup
      source: field_states_operating_in
      entity_type: taxonomy_term
      value_key: name
      bundle_key: vid
      bundle: states_operating


Get this bounty!!!

#StackBounty: #migration Why does step 2 in migrating files to media try to insert to the nid from the source and not the target?

Bounty: 150

I am doing a migration as per this example https://www.drupal.org/project/migrate_file_to_media/issues/3118471. Migration and step 1 work fine, I get this error when running step 2. I also tried running the migration with an –update flag (drush mim migd8_blog_media_step2 –update) and get the same error . its trying to do an insert instead of an update. And its trying to insert into the source nid, not the target nid.

DrupalCoreDatabaseIntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘title'[error]cannot be null: INSERT INTO {​​​​​node_field_data}​​​​​ (nid, vid, type, langcode, status, uid, title, created, changed, promote, sticky,
default_langcode, revision_translation_affected, publish_on, unpublish_on) VALUES (:db_insert_placeholder_0,
:db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4,
:db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8,
:db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12,
:db_insert_placeholder_13, :db_insert_placeholder_14); Array
(
[:db_insert_placeholder_0] => 22610

This is the id of the source node, not the target
The migration file I am using contains the following lines.

# This migration links the newly created media entities with entity reference field on the target bundle.
id: migd8_blog_media_step2
label: blog Media Mapping
source:
  key: migrate
  plugin: d7_node
  node_type: blog_entry
destination:
  plugin: entity:node
  default_bundle: blog
process: 
  nid: nid
  changed: changed
  field_files:
    plugin: file_id_lookup
    source: field_main_image
    migration: migd8_blog_media_step1
    no_stub: true
migration_dependencies:
  optional:
  - migd8_node_blog
  - migd8_blog_media_step1

this is my step 1:

# File to Media Migration configuration for blog Media migration

id: migd8_blog_media_step1
label: blog Media Step 1
migration_group: cncs
source:
  key: migrate
  plugin: media_entity_generator_d7
  entity_type: node
  bundle: blog_entry
  langcode: und
  d7_file_url: 'https://www.nationalservice.gov/sites/default/files/'
  #d7_file_url: 'public://'
  field_names:
    - field_main_image

destination:
  plugin: entity:media

process:
    
  bundle:
    plugin: default_value
    default_value: image

  # Using the alt tag if available, else the file name.
  name:
    plugin: media_name
    source: file_name

  # This process plugin will skip the whole row if a existing media is found.
  existing_media_file:
    plugin: check_media_duplicate
    source: target_id

  # This process plugin will skip the whole row if a duplicate image is found.
  unique_file_id:
    plugin: check_duplicate
    source: target_id
    
  # Map the field 
  
  
  field_media_image/alt: alt
  field_media_image/title: title
  field_media_image/target_id:
    plugin: media_file_copy
    move: FALSE
    reuse: TRUE
    path: 'public://images/'
    source: file_path

  langcode: langcode
   
  uid:
    plugin: default_value
    default_value: 1
`

here is my main migration yml :

id: 

migd8_node_blog
label: Custom node migration from Drupal 7
migration_group: cncs
dependencies:
  enforced:
    module:
      - migd8_node_blog_node
source:
 plugin: migd8_node_blog_node # use custom source plugin
 node_type: blog_entry
destination:
  plugin: entity:node
  bundle: blog
process:
  'path/pathauto':
    plugin: default_value
    default_value: 0 # Disable pathauto.
  'path/alias': alias
  type: 
    plugin: default_value
    default_value: blog
  status: status
  uid: 
    plugin: default_value
    default_value: 1
  title: title
  langcode:
    plugin: static_map
    bypass: true
    source: language
    map:
      und: en
  created: created
  changed: changed
  promote: promote
  field_blog_tags:
    plugin: migration_lookup
    source: field_blog_tags
    migration: migrate_taxonomy
  sticky: sticky
  body:
      plugin: sub_process
      source: body
      process:
        value: value
        summary: summary
        format:
          plugin: default_value
          default_value: full_html
  field_blog_author: field_blog_author        
  field_blog_post_date_: 
    plugin: iterator
    source: field_blog_post_date_
    process:
      value:
        plugin: substr
        source: value
        start: 0
        length: 10

I realize its looking for the source nid in this query , not the target nid
DrupalCoreDatabaseIntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘title'[error]cannot be null: INSERT INTO {​​​​​node_field_data}​​​​​ (nid, vid, type, langcode, status, uid, title, created, changed, promote, sticky,
default_langcode, revision_translation_affected, publish_on, unpublish_on) VALUES (:db_insert_placeholder_0,
:db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4,
:db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8,
:db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12,
:db_insert_placeholder_13, :db_insert_placeholder_14); Array
(
[:db_insert_placeholder_0] => 22610
22610 is the node id in the source.
in the target its a totally different nid


Get this bounty!!!

#StackBounty: #migration Why does step 2 in migrating files to media fail?

Bounty: 150

I am doing a migration as per this example https://www.drupal.org/project/migrate_file_to_media/issues/3118471. Migration and step 1 work fine, I get this error when running step 2.

Missing bundle for entity type node (/var/www/html/docroot/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:108)

The migration file I am using contains the following lines.

# This migration links the newly created media entities with entity reference field on the target bundle.
id: migd8_blog_media_step2
label: blog Media Mapping
source:
  key: migrate
  plugin: d7_node
  node_type: blog_entry
destination:
  plugin: entity:node
  
process: 
  nid: nid
  changed: changed
  field_files:
    plugin: file_id_lookup
    source: field_main_image
    migration: migd8_blog_media_step1
    no_stub: true
migration_dependencies:
  optional:
  - migd8_node_blog
  - migd8_blog_media_step1


Get this bounty!!!

#StackBounty: #sql-server #migration #active-directory SQL Server 20002005 compatibility with Active Directory 2016

Bounty: 50

We are currently using Active Directory 2008R2 and will be upgrading to AD 2016. I’m trying to determine if there is any known compatibility issues when running older versions of SQL Server (2000 and 2005) when upgrading to AD 2016. Has anyone been through this process? Most of our db servers are using SQL 2008 > 2016, but a few still runs with 2000/2005. Thanks


Get this bounty!!!

#StackBounty: #sql-server #migration #active-directory SQL Server 20002005 compatibility with Active Directory 2016

Bounty: 50

We are currently using Active Directory 2008R2 and will be upgrading to AD 2016. I’m trying to determine if there is any known compatibility issues when running older versions of SQL Server (2000 and 2005) when upgrading to AD 2016. Has anyone been through this process? Most of our db servers are using SQL 2008 > 2016, but a few still runs with 2000/2005. Thanks


Get this bounty!!!

#StackBounty: #sql-server #migration #active-directory SQL Server 20002005 compatibility with Active Directory 2016

Bounty: 50

We are currently using Active Directory 2008R2 and will be upgrading to AD 2016. I’m trying to determine if there is any known compatibility issues when running older versions of SQL Server (2000 and 2005) when upgrading to AD 2016. Has anyone been through this process? Most of our db servers are using SQL 2008 > 2016, but a few still runs with 2000/2005. Thanks


Get this bounty!!!

#StackBounty: #sql-server #migration #active-directory SQL Server 20002005 compatibility with Active Directory 2016

Bounty: 50

We are currently using Active Directory 2008R2 and will be upgrading to AD 2016. I’m trying to determine if there is any known compatibility issues when running older versions of SQL Server (2000 and 2005) when upgrading to AD 2016. Has anyone been through this process? Most of our db servers are using SQL 2008 > 2016, but a few still runs with 2000/2005. Thanks


Get this bounty!!!

#StackBounty: #sql-server #migration #active-directory SQL Server 20002005 compatibility with Active Directory 2016

Bounty: 50

We are currently using Active Directory 2008R2 and will be upgrading to AD 2016. I’m trying to determine if there is any known compatibility issues when running older versions of SQL Server (2000 and 2005) when upgrading to AD 2016. Has anyone been through this process? Most of our db servers are using SQL 2008 > 2016, but a few still runs with 2000/2005. Thanks


Get this bounty!!!

#StackBounty: #sql-server #migration #active-directory SQL Server 20002005 compatibility with Active Directory 2016

Bounty: 50

We are currently using Active Directory 2008R2 and will be upgrading to AD 2016. I’m trying to determine if there is any known compatibility issues when running older versions of SQL Server (2000 and 2005) when upgrading to AD 2016. Has anyone been through this process? Most of our db servers are using SQL 2008 > 2016, but a few still runs with 2000/2005. Thanks


Get this bounty!!!