public function destroyMigrationData($module_name) {
    if (empty($module_name)) {
      return;
    }
    // Get config entities that are dependent on module.
    $dependencies = $this->configManager->findConfigEntityDependentsAsEntities('module', (array) $module_name);
    // Create array of dependent migrations for module.
    // That module should be listed in dependencies of migration config.
    foreach ($dependencies as $dependency) {
      /** @var \Drupal\migrate_plus\Entity\Migration $dependency */
      if ($dependency->getEntityTypeId() == 'migration') {
        $migration_list[] = $dependency->get('id');
      }
    }
    if (!empty($migration_list)) {
      $migrations = $this->migrationManager->createInstances($migration_list);
      /** @var \Drupal\migrate\Plugin\Migration $migration */
      foreach ($migrations as $migration) {
        // Remove migration data in DB for this migration.
        $migration->getIdMap()->destroy();
      }
    }
  }
public function destroyMigrationData($module_name) {
    if (empty($module_name)) {
      return;
    }
    // Get config entities that are dependent on module.
    $dependencies = $this->configManager->findConfigEntityDependentsAsEntities('module', (array) $module_name);
    // Create array of dependent migrations for module.
    // That module should be listed in dependencies of migration config.
    foreach ($dependencies as $dependency) {
      /** @var \Drupal\migrate_plus\Entity\Migration $dependency */
      if ($dependency->getEntityTypeId() == 'migration') {
        $migration_list[] = $dependency->get('id');
      }
    }
    if (!empty($migration_list)) {
      $migrations = $this->migrationManager->createInstances($migration_list);
      /** @var \Drupal\migrate\Plugin\Migration $migration */
      foreach ($migrations as $migration) {
        // Remove migration data in DB for this migration.
        $migration->getIdMap()->destroy();
      }
    }
  }
public function destroyMigrationData ( $ module_name ) { if ( empty ( $ module_name ) ) { return ; } // Get config entities that are dependent on module. $ dependencies = $ this -> configManager -> findConfigEntityDependentsAsEntities ( 'module' , ( array ) $ module_name ) ; // Create array of dependent migrations for module. // That module should be listed in dependencies of migration config. foreach ( $ dependencies as $ dependency ) { /** @var \Drupal\migrate_plus\Entity\Migration $dependency */ if ( $ dependency -> getEntityTypeId ( ) == 'migration' ) { $ migration_list [ ] = $ dependency -> get ( 'id' ) ; } } if ( ! empty ( $ migration_list ) ) { $ migrations = $ this -> migrationManager -> createInstances ( $ migration_list ) ; /** @var \Drupal\migrate\Plugin\Migration $migration */ foreach ( $ migrations as $ migration ) { // Remove migration data in DB for this migration. $ migration -> getIdMap ( ) -> destroy ( ) ; } } }
Destroy database migration data for migrations dependent from module.

@param string $module_name
Module for destroy data.
Module should be added as enforced dependency in migration config.
Destroy database migration data for migrations dependent from module .