You are here

function drush_migrate_upgrade in Migrate Upgrade 8.3

Same name and namespace in other branches
  1. 8 migrate_upgrade.drush.inc \drush_migrate_upgrade()
  2. 8.2 migrate_upgrade.drush.inc \drush_migrate_upgrade()

Execute the upgrade command, configuring the necessary migrations.

Optionally perform the imports.

File

./migrate_upgrade.drush.inc, line 48
Command-line tools to aid performing and developing upgrade migrations.

Code

function drush_migrate_upgrade() {
  $runner = new MigrateUpgradeDrushRunner(Drush::logger());
  try {
    $runner
      ->configure();
    if (drush_get_option('configure-only')) {
      $result = $runner
        ->export();
      foreach ($result as $original => $prefixed_migration) {
        drush_print(dt('Exporting @migration as @new_migration', [
          '@migration' => $original,
          '@new_migration' => $prefixed_migration,
        ]));
      }
    }
    else {
      $runner
        ->import();
      \Drupal::state()
        ->set('migrate_drupal_ui.performed', \Drupal::time()
        ->getRequestTime());
    }

    // Remove the global database state.
    \Drupal::state()
      ->delete('migrate.fallback_state_key');
  } catch (\Exception $e) {
    drush_log($e
      ->getMessage(), 'error');
  }
}