1

update.php and drush up --no-core both list several database updates pending across several modules. I'm being asked to only apply the database updates for a few specific modules because it is desired to do just these modules and test things in relation to that before running any of the other updates.

drush seems to only give me the option to apply all of the pending updates as does the update.php script. Is there a way to apply only the pending database updates for a particular module when there are pending updates for multiple?

0

A quick and dirty solution is to comment out the pending update fuctions on the modules you won't update.

... but don't tell around that I suggested you this hack :-)

  • 1
    If it comes to hacking at the code I think I'd start at the update.php rather then tracking down all the modules to not update and then potentially forget to undo it in one of them. – lathomas64 Jan 8 '14 at 19:19
  • @lathomas64: I agree with this. Added the drush method to my answer, and made it a bit more verbose. – Ursula Jan 8 '14 at 20:37
2

Drush allows you to just update a module you specify:

drush up module_machine_name

If you just want to apply pending database updates, for the modules that have already been updated:

drush updatedb

This case is relevant when updating the code base through git, or for multisite installations. In your specific case, this might be what you were looking for - just apply database updates (using this command: for all modules that require database updates), but don't update any additional codebase.

If you want to just apply the updates for a certain module, you can do this also manually. The updates can be found in the module.install file:

function modulename_update_prioritynumber
(e.g. devel_update_7000)

The priority number determines the order of the updates to be applied. You can manually execute the code for the updates using drush:

drush eval "the update code"

for example:

drush eval "variable_del('dev_query');
drush @yoursite eval "variable_del('dev_query');

(@yoursite added if bootstrapping is needed for multisite installations)

This example will delete the variable dev_query from the variable database table (from the function devel_update_7002).

For more discussion on this, see: drush updatedb for a single module - especially the answer from moshe weitzman, the drush maintainer, about applying individual updates. I'd recommend applying the updates of the module you are concerned about over uncommenting the updatedb statements in other modules - as the other answer suggests.

  • this did not apply the pending database updates for me, this is what i attempted initially. – lathomas64 Jan 8 '14 at 16:23
  • There is no way I know of to do a database update for an individual module. If you have already downloaded the updates, they will be updated with the update.php script. If you want to update modules individually, you should download the updates individually as well. – Елин Й. Jan 8 '14 at 16:29
  • Ammended my answer to add updatedb. I do not know whether updatedb also accepts a module name - cannot test right now. In any case, if you only do a selected updatedb, the code base for other modules would not agree with the database state, possibly resulting in unpredictable behavior. – Ursula Jan 8 '14 at 17:19

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.