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:



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
  - Drupal 7
      - mymodule
  plugin: d7vm_users
  plugin: entity:user
  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

 * @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',


1 Answer 1


If your source plugin extends SqlBase, you need to make sure you have the database configuration set up correctly. Otherwise Migrate will silently ignore the migration.

In your settings.php or settings.local.php, add the following database configuration:

$databases['migrate']['default'] = array(
  'driver' => 'mysql',
  'database' => 'NAME OF YOUR SOURCE DB',
  'username' => 'YOUR DB USER',
  'password' => 'YOUR DB PASSWORD',
  'host' => 'localhost',  // change this as necessary

By default, Migrate looks for a DB connection named "migrate". If you use any other name, the migrations won't appear when you run drush migrate-status.

Note: The "migrate" connection is in addition to your "default" connection. You should have two connections in your settings if you're migrating from a MySQL database.

In case anyone's curious, the DB connection check occurs in the method SqlBase::getDatabase() in drupal/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php.

This is documented in https://www.drupal.org/node/2830031 and apparently will be fixed in Drupal 8.4.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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