Major module update with Composer 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?
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


$ composer require drupal/admin_toolbar to upgrade the module.
$ drush cr &amp;&amp; drush -y updb to perform database updates.
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.


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