Drush updb fails when upgrading from 8.x-1.0 to 2.0.5

Created on 4 October 2022, about 2 years ago
Updated 20 October 2023, about 1 year ago

Problem/Motivation

When module upgraded from 8.x-1.0 to 2.x it's not possible to run drush updb.
Starting from 2.x version this module using "migrate_tools" module as dependency and this module installed in update hook path_redirect_import_update_9001.
But drush updb failed because registration of drush services in cotainer runs before drush updb command and drush service /src/Commands/PathRedirectImportCommands.php extends MigrateToolsCommands class from migrate_tools module which was not installed yet. This is leads to error after running drush updb:
[error] Error: Class "Drupal\migrate_tools\Commands\MigrateToolsCommands" not found in include() (line 27 of /modules/contrib/path_redirect_import/src/Commands/PathRedirectImportCommands.php)

Steps to reproduce

  1. Install module "path_redirect_import" version 8.x-1.0-beta5. Make sure that the module "migrate_tools" is not installed.
  2. Upgrade module "path_redirect_import" to 2.0.5 version
  3. Run drush updb

Result:
[error] Error: Class "Drupal\migrate_tools\Commands\MigrateToolsCommands" not found in include() (line 27 of /modules/contrib/path_redirect_import/src/Commands/PathRedirectImportCommands.php)

Proposed resolution

Disable drush service "path_redirect_import.commands" before module "migrate_tools" not installed.

Remaining tasks

Write a patch

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇷🇺Russia qzmenko Novosibirsk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024