Following this I have created a module to migrate d7 users to d8. I have enabled all mandatory modules needed to run migration. But when I do drush migrate-import {mymigrationid}
; it says : Migration not found.
But When I did "drush config-list|grep migrate"
, it is showing that particular migration:
migrate.migration.d7vm_users
migrate_plus.migration.custom_user
But when I'm doing drush migrate-status
, these migrations are not listing up there.
Can anyone tell what's supposed to get missed?
Here is my mymodule/config/install/vm.yml file
id: d7vm_users
label: User accounts
migration_tags:
- Drupal 7
dependencies:
enforced:
module:
- mymodule
source:
plugin: d7vm_users
destination:
plugin: entity:user
process:
uid: uid
name: name
pass: pass
mail: mail
created: created
access: access
login: login
status: status
timezone: timezone
langcode: language
init: init
and src/Plugin/migrate/source/User.php
<?php
/**
* @file
* Contains \Drupal\mymodule\Plugin\migrate\source\User.
*/
namespace Drupal\mymodule\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
/**
* Extract users from Drupal 7 database.
*
* @MigrateSource(
* id = "d7vm_users"
* )
*/
class User extends SqlBase {
/**
* {@inheritdoc}
*/
public function query() {
return $this->select('users', 'dcf_u')
->fields('dcf_u', ['uid', 'status', 'created','access', 'login', 'name',
'pass', 'mail', 'init', 'language']);
}
/**
* {@inheritdoc}
*/
public function fields() {
$fields = [
'uid' => $this->t('Account ID'),
'status' => $this->t('Blocked/Allowed'),
'created' => $this->t('Registered date'),
'access' => $this->t('Time of last access'),
'login' => $this->t('Time of last login'),
'name' => $this->t('Account name (for login)'),
'pass' => $this->t('Account password (raw)'),
'mail' => $this->t('Account email'),
'init' => $this->t('init'),
'language' => $this->t('language'),
];
return $fields;
}
/**
* {@inheritdoc}
*/
public function getIds() {
return [
'uid' => [
'type' => 'integer',
'alias' => 'dcf_u',
],
];
}
}
?>