Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[migrate:*] Updated commands to process migrations #2493

Merged
merged 1 commit into from Jul 5, 2016
Merged

[migrate:*] Updated commands to process migrations #2493

merged 1 commit into from Jul 5, 2016

Conversation

miguel303
Copy link
Contributor

List of changes:

  • Now we are using plugins to get a list of migrations ids
    I removed the method getMigrations() from src/Command/ContainerAwareCommand.php and I moved it to a new Trait called MigrationTraid.

    We load migrations using this:
    $plugin_manager = $this->getDrupalService('plugin.manager.migration'); $all_migrations = $plugin_manager->createInstancesByTag($version_tag);

  • To get those migrations we must to set up the database settings, so I made some changes to command migrate:setup
    This command now only load the database configuration , so I removed the code which generate templates.

  • In order to get the dbTypes now we are calling the function directly from the core with:
    include_once DRUPAL_ROOT . '/core/includes/install.inc'; return drupal_get_database_types();

  • To execute a migration , we create instances using the plugins
    $migration_service = $this->getDrupalService('plugin.manager.migration'); $migration_service = $migration_service->createInstance($migration_id);

  • Note: To get a list of migrations , just run drupal migrate:debug and you are going to a get the full list , so if you want filter that list , try with drupal migrate:debug 7 or drupal migrate:debug 6

@enzolutions
Copy link
Contributor

Thanks @miguel303 for your contribution, @willwh could you test before we release

@enzolutions enzolutions merged commit ec11a4f into hechoendrupal:master Jul 5, 2016
@willwh
Copy link
Contributor

willwh commented Jul 5, 2016

Hi @enzolutions, I took this for a rip. Looking at the code, this is only for setting up a migration from plugins in core.

migrate:setup seems to be working nicely, although I don't see a way to see which migrations have been created.

migrate:execute works nicely for plugins loaded from core, although, it seems there is some duplication here. I don't understand the point of having migrate:setup and then having this as part of the migrate:execute command.

As an explanation Migrate Tools handles custom migrations (executing them and rolling them back, as status) - and I think DC needs to have support for this too: http://cgit.drupalcode.org/migrate_tools/tree/migrate_tools.drush.inc#n256

Also see: http://cgit.drupalcode.org/migrate_plus/tree/src/Plugin/MigrationConfigEntityPluginManager.php

That's my initial thoughts, as I said, migrate:execute seems to work well, but I think this is not ideal, as most people running migrations will not be doing a "whole hog" migration, but much more likely to use some form of custom migration, this is particularly true when migrating from Non-Drupal sources.

Take a peek at Custom Drupal-to-Drupal Migrations with Migrate Tools for an idea of how to do this with Drush.

@enzolutions
Copy link
Contributor

@willwh ok feel free to propose a new PR to eliminate or adjust setup.

One note is, you don't need to execute all migrations, you can execute one one migration or more passing the exact migrations ids.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants