1

I have some modules in 8.8.5 that need an major update. What is the best practice without loosing data or settings?

For example: drupal/admin_toolbar 1.27.0 2.2.0

  • Do I need to uninstall the module in de admin backoffice Drupal?
  • If so, I first need to uninstall both modules: Required by: admin_toolbar_tools, adminimal_admin_toolbar
  • Finally uninstall admin_toolbar
  • Composer remove drupal/admin_toolbar
  • Composer require drupal/admin_toobar
  • Drush updatedb
  • Drush cr

Is that the correct way? Or can I simply remove the old version with composer and require the new one?

  • 2
    composer update is the simpler way, if there aren't issues with updating the other modules. Once the code is updated, you can visit update.php, after being sure you are logged in as administrator. – kiamlaluno May 11 at 13:33
2

No you don't uninstall the module first. You want to have the module enabled when updating to let possible database updates kick in. Which may be performed to update existing data/entities. If you already have the latest 1.x version installed you could simply do

  1. $ composer require drupal/admin_toolbar to upgrade the module.
  2. $ drush cr && drush -y updb to perform database updates.
  3. And finally $ drush -y cex to export any eventually updated config.

If you don't have the latest 1.x version installed yet, it's better to upgrade incrementally. And to play really safe to also do two consecutive releases for that.

  1. $ composer update drupal/admin_toolbar --with-dependencies && drush cr && drush -y updb && drush -y cex to first update to the latest 1.x version, followed by a release.
  2. And then $ composer require drupal/admin_toolbar && drush cr && drush -y updb && drush -y cex to get the latest major upgrade, followed by another release.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.