34

For example, I'm currently using the Geofield module. I'm using version:

7.x-1.0-beta2 (2011-Nov-17)

Now I see the development version has some functionality that I want. How do I correctly and safely "upgrade" to the development version of the module?

7.x-1.x-dev (2012-Jan-10)

What I currently do is, remove the geofield from any content types, disable the geofield module, uninstall the geofield module, physically delete the geofield module from my server, and then download and install the dev version. This seems to work but I'm wondering if there is a more efficient workflow.

(I have drush installed so I'm open to a solution involving drush)

42

From the working directory (site root) use this command:

drush dl module_name --dev

To get the DEV version.

Or:

drush dl module_name --select

To display a list of available versions.

Afterwards do drush updatedb to apply any database updates made by the module. You should check out https://drushcommands.com/ and all the commands on that page (the aliases are at the end of each section). For example, drush up will check for all possible updates.

In most cases you will not need to disable and uninstall things first but always make sure you are working in a dev environment and have regular backups (e.g. use the backup_migrate module). Drush will also backup the previous version of the module when usingdrush upbut NOT if you directly overwrite withdrush dl`.

  • 4
    Clearing the cache is also worth doing: drush cc all – Amir T May 14 '13 at 19:44
  • 2
    @AmirT You don't need to clear the cache after drush updatedb command, since it does clear the cache already after running database updates. – Елин Й. Oct 24 '14 at 13:55
  • 5
    If you want to change versions but aren't sure which, drush dl --select gives you a list to choose from. Just remember to updatedb afterwards. – rymo Jun 17 '15 at 19:36
33

You can use drush pm-update to update any module, and add the version information to update to a specific version. For example if you want to update to a 7.x-1.x-dev version of a module, you can use the following command:

drush pm-update MODULE_NAME-7.x-1.x-dev

or, shorter:

drush up MODULE_NAME-1.x-dev

so you can omit 7.x-.

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.