0

I'm trying a tutorial to migrate users data from a CSV file.
From here: https://u.group/thinking/drupal-8-csv-migration/

I've created a module as suggested. Here is the code:

/config/install/migrate_plus.migration.demo_user_migration.yml

id: demo_user_migration
langcode: en
dependencies:
  enforced:
    module:
      - user_migrate
label: 'User migration from CSV'
source:
  plugin: csv
  track_changes: true
  path: /config/users.csv
  header_row_count: 1
  ids: 
    - Uid
destination:
  plugin: entity:user
process:
  name: Name
  mail: E-mail
  field_last_name: First Name
  field_first_name: Last Name
  status: Active status
migration_dependencies:
  required: {  }
  optional: {  }

user_migrate.info.yml

name: User Migrate
type: module
description: Custom Migrate of Users using a CSV file
core: 8.x
package: Migration
dependencies:
    - migrate_source_csv
    - migrate_plus
    - migrate_tools

user_migrate.module

<?php

/**
 * @file
 * Contains teacher_migrate.module.
 */

use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function user_migrate_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    // Main module help for the custom_user_migrate module.
    case 'help.page.user_migrate':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('User Migrate') . '</p>';
      return $output;

  }
}

/**
 * Implements hook_migration_plugins_alter().
 */
function teacher_migrate_migration_plugins_alter(&$definitions) {
  $definitions['demo_user_migration']['source']['path'] =
    drupal_get_path('module', 'user_migrate') . $definitions['demo_user_migration']['source']['path'];
}

I've enabled the module from the Extend page.

However, when I run drush migration:status the migration I've created is not found. This confirmed by executing drush migrate:import demo_user_migration

Do you know where the problem can be?

2
  • Is the path definitely correct in migrate_plus.migration.demo_user_migration.yml? – edg Jun 21 '20 at 20:45
  • Yes, all the paths are correct – DamianFox Jun 22 '20 at 7:35
0

Did you try clearing drush cache with drush cr drush?

Also, the correct notation for checking the status is drush migrate-status demo_user_migration

1
  • Yes, I've tried the first command. The second command returns an empty table. – DamianFox Jun 22 '20 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.