1

I am trying to follow the upgrade using drush tutorial but I cannot get the migrate commands to appear in drush. On a new Ubuntu 16 box I do:

#install a new drupal 8
composer create-project drupal-composer/drupal-project:8.x-dev drupal8 --stability dev --no-interaction
cd drupal8
composer install

#install drush
composer require drush/drush
cd /var/www/drupal8
wget -O drush.phar https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar
sudo mv drush.phar /usr/local/bin/drush
chmod +x /usr/local/bin/drush

I then go to the website and set it up. It creates the database etc. Everything seems OK. Then, I install the migration packages

cd /var/www/drupal8/drupal8
composer require drupal/migrate_upgrade
composer require drupal/migrate_plus
composer require drupal/migrate_tools
# Enable migration packages
drush en migrate migrate_drupal migrate_upgrade migrate_plus migrate_tools
drush cr
drush cc drush

At this point I have the migration packages installed and enabled:

% drush pml | grep Migration
  Migration             Migrate (migrate)                                  Enabled    8.5.1
  Migration             Migrate Advanced Example Setup                     Disabled   8.x-2.0-beta2
  Migration             Migrate Example Setup (migrate_example_setup)      Disabled   8.x-2.0-beta2
  Migration             Migrate Plus (migrate_plus)                        Enabled    8.x-2.0-beta2
  Migration             Migrate Tools (migrate_tools)                      Enabled    8.x-2.0-beta1
  Migration             Drupal Upgrade (migrate_upgrade)                   Enabled    8.x-2.0-beta1

and yet, drush list does not show any migrate commands:

%drush list
Drush Commandline Tool 9.2.1

Run `drush help [command]` to view command-specific help.  Run `drush topic` to read even more documentation.

 Available commands:
 _global:
   help                                       Display usage details for a command.
   list                                       List available commands.
   updatedb (updb)                            Apply any database updates required (as with running
                                              update.php).
   runserver (rs, serve)                      Runs PHP's built-in http server for development.
   browse                                     Display a link to a given path or open link in a
                                              browser.
   version                                    Show Drush version.
   generate (gen)                             Generate boilerplate code for
                                              modules/plugins/services etc.
   drupal:directory (dd)                      Return the filesystem path for modules/themes and
                                              other key folders.
   updatedb:status (updbst)                   List any pending database updates.
   twig:compile (twigc)                       Compile all Twig template(s).
 cache:
   cache:get (cg)                             Fetch a cached object and display it.
   cache:clear (cc)                           Clear a specific cache, or all Drupal caches.
   cache:set (cs)                             Cache an object expressed in JSON or var_export()
                                              format.
   cache:rebuild (cr, rebuild)                Rebuild a Drupal 8 site.
 config:
   config:pull (cpull)                        Export and transfer config from one environment to
                                              another.
   config:get (cget)                          Display a config value, or a whole configuration
                                              object.
   config:set (cset)                          Set config value directly. Does not perform a config
                                              import.
   config:edit (cedit)                        Open a config file in a text editor. Edits are
                                              imported after closing editor.
   config:delete (cdel)                       Delete a configuration key, or a whole object.
   config:status (cst)                        Display status of configuration (differences between
                                              the filesystem configuration and database
                                              configuration).
   config:export (cex)                        Export Drupal configuration to a directory.
   config:import (cim)                        Import config from a config directory.
 core:
   core:topic (topic)                         Read detailed documentation on a given topic.
   core:init (init)                           Enrich the bash startup file with bash aliases and a
                                              smart command prompt.
   core:edit (conf, config)                   Edit drushrc, site alias, and Drupal settings.php
                                              files.
   core:rsync (rsync)                         Rsync Drupal code or files to/from another server
                                              using ssh.
   core:status (status, st)                   An overview of the environment - Drush and Drupal.
   core:execute (exec, execute)               Execute a shell command. Usually used with a site
                                              alias.
   core:cron (cron)                           Run all cron hooks in all active modules for
                                              specified site.
   core:requirements (status-report, rq)      Information about things that may be wrong in your
                                              Drupal installation.
 entity:
   entity:updates (entup)                     Apply pending entity schema updates.
   entity:delete (edel)                       Delete content entities.
 image:
   image:flush (if)                           Flush all derived images for a given style.
   image:derive (id)                          Create an image derivative.
 locale:
   locale:check                               Checks for available translation updates.
   locale:update                              Imports the available translation updates.
 php:
   php:eval (eval, ev)                        Evaluate arbitrary php code after bootstrapping
                                              Drupal (if available).
   php:script (scr)                           Run php a script after a full Drupal bootstrap.
   php:cli (php, core:cli, core-cli)          Open an interactive shell on a Drupal site.
 pm:
   pm:security (sec)                          Check Drupal Composer packages for pending security
                                              updates.
   pm:enable (en)                             Enable one or more modules.
   pm:uninstall (pmu)                         Uninstall one or more modules and their dependent
                                              modules.
   pm:list (pml)                              Show a list of available extensions (modules and
                                              themes).
 queue:
   queue:run                                  Run a specific queue by name.
   queue:list                                 Returns a list of all defined queues.
   queue:delete                               Delete all items in a specific queue.
 role:
   role:create (rcrt)                         Create a new role.
   role:delete (rdel)                         Delete a new role.
   role:perm:add (rap, role-add-perm)         Grant specified permission(s) to a role.
   role:perm:remove (rmp, role-remove-perm)   Remove specified permission(s) from a role.
   role:list (rls)                            Display a list of all roles defined on the system.
 site:
   site:ssh (ssh)                             Connect to a Drupal site's server via SSH.
   site:install (si, sin)                     Install Drupal along with
                                              modules/themes/configuration/profile.
   site:set (use)                             Set a site alias that will persist for the current
                                              session.
   site:alias (sa)                            Show site alias details, or a list of available site
                                              aliases.
   site:alias-convert (sa-convert, sac)       Convert legacy site alias files to the new yml
                                              format.
 sql:
   sql:connect                                A string for connecting to the DB.
   sql:create                                 Create a database.
   sql:drop                                   Drop all tables in a given database.
   sql:cli (sqlc)                             Open a SQL command-line interface using Drupal's
                                              credentials.
   sql:query (sqlq)                           Execute a query against a database.
   sql:dump                                   Exports the Drupal DB as SQL using mysqldump or
                                              equivalent.
   sql:sync                                   Copy DB data from a source site to a target site.
                                              Transfers data via rsync.
   sql:sanitize (sqlsan)                      Sanitize the database by removing or obfuscating
                                              user data.
 state:
   state:get (sget)                           Display a state value.
   state:set (sset)                           Set a state value.
   state:delete (sdel)                        Delete a state entry.
 theme:
   theme:enable (then)                        Enable one or more themes.
   theme:uninstall (thun)                     Uninstall theme.
 user:
   user:login (uli)                           Display a one time login link for user ID 1, or
                                              another user.
   user:information (uinf)                    Print information about the specified user(s).
   user:block (ublk)                          Block the specified user(s).
   user:unblock (uublk)                       UnBlock the specified user(s).
   user:role:add (urol, user-add-role)        Add a role to the specified user accounts.
   user:role:remove (urrol, user-remove-role) Remove a role from the specified user accounts.
   user:create (ucrt)                         Create a user account.
   user:cancel (ucan)                         Cancel user account(s) with the specified name(s).
   user:password (upwd)                       Set the password for the user account with the
                                              specified name.
 views:
   views:dev (vd)                             Set several Views settings to more
                                              developer-oriented values.
   views:list (vl)                            Get a list of all views in the system.
   views:execute (vex)                        Execute a view and show a count of the results, or
                                              the rendered HTML.
   views:analyze (va)                         Get a list of all Views and analyze warnings.
   views:enable (ven)                         Enable the specified views.
   views:disable (vdis)                       Disable the specified views.
 watchdog:
   watchdog:show (wd-show, ws)                Show watchdog messages.
   watchdog:list (wd-list)                    Interactively filter the watchdog message listing.
   watchdog:delete (wd-del, wd-delete, wd)    Delete watchdog log records.
   watchdog:show-one (wd-one)                 Show one log record by ID.

Drush version is:

% drush --version
Drush Launcher Version: 0.6.0
Drush Commandline Tool 9.2.1

I can see the packages are installed in the web/modules/contrib directory, where I find migrate_tools/migrate_tools.drush.inc. Drush should be finding this file and adding the commands in it. Why isn't it?

------------------- Update:

My website's admin/modules/update page told me that my migration modules were old (oddly, since I did composer require.. just an hour ago). I updated them with:

composer require drupal/migrate_plus:4.0-beta3 drupal/migrate_tools:4.0-beta3 drupal/migrate_upgrade:3.0-rc4
drush cr

and now I do get some migrate commands, but not the migrate-upgrade command I need.

% drush list | grep migrate
 migrate:
   migrate:status (ms)                        List all migrations with current status.
   migrate:import (mim)                       Perform one or more migration processes.
   migrate:rollback (mr)                      Rollback one or more migrations.
   migrate:stop (mst)                         Stop an active migration operation.
   migrate:reset-status (mrs)                 Reset a active migration's status to idle.
   migrate:messages (mmsg)                    View any messages associated with a migration.
   migrate:fields-source (mfs)                List the fields available for mapping in a source.

2 Answers 2

3

Your Migrate Tools and Migrate Upgrade tools have a version not suitable for Drupal 8.5.x. You can see at their web page. For example:

https://www.drupal.org/project/migrate_upgrade

8.x-3.x: This branch works with Drupal 8.2.x and above.
8.x-2.0: This release works only with Drupal 8.1.x. This release is no longer supported.
8.x-1.0: This release works only with Drupal 8.0.x. This release is no longer supported.

And https://www.drupal.org/project/migrate_tools:

8.x-4.0-beta2+ - Compatible with Drupal 8.3.x and above and Drush 8/9, this is where primary development will be focused.
8.x-3.0-rc1 - Compatible with Drupal 8.2.x only, support for major/critical bug fixes only.
8.x-2.0 - Compatible with Drupal 8.1.x only, no longer supported.
8.x-1.0 - Compatible with Drupal 8.0.x only, no longer supported.

Then, you should update both:

composer require 'drupal/migrate_tools:^4.0'

composer require 'drupal/migrate_upgrade:^3.0'

And clear drush cache:

vendor/bin/drush cc drush

Not sure if a Drupal cache rebuit is needed (drush cr)

After it, you can see your migrate commands in the drush command list:

vendor/bin/drush list
1

The final answer was that migrate-upgrade still does not work with drush 9. But, applying the patch on that page does make it work.

The drush migrate:upgrade command appears!

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.