2

I've updated a bunch of modules in my local development environment and then committed the code changes using git.

On my test site, I've pulled the code and ran drush updb but it's showing that nothing needs to be updated and that the modules I updated are now current. In the past, every time I've performed updates, I was under the assumption that there was a database updating component to it and whenever I ran drush updb it would take the code that was just implemented with git and run the update. Not sure, why it's different this time, can someone explain? Am I missing a command? If there are no database updates needed, I can go on knowing the updates are truly complete?

If database updates aren't require for all module updates, can someone give an example of when updates do and do not touch the database?

Edit: An example of one such update was to the address fields token or to the Google Static Maps module.

2

What makes you think that, for any of the updated modules, part of the actual updates included some database update to be performed? In other words: there are (plenty) of cases where, if you update some module, there are no related database updates that are included in such module update.

From "Writing .install files (Drupal 7.x)", within the parg "Module updates using hook_update_N":

Updating your module, for example updating your schema, can be done using hook_update_N functions. The API page for this is at: function hook_update_N.

Suppose you add a new column called 'newcol' to mytable1. First, be sure to update your schema structure in mymodule_schema() so that newly created tables get the new column. Then, add an update function to mymodule.install ...

Have a look at this part of an .install file about an update of the database for the Rules module, and which looks like so:

/**
 * Creates a flag that enables a permission for using components.
 */
function rules_update_7209() {
  // Create a access exposed flag column.
  db_add_field('rules_config', 'access_exposed', array(
    'type' => 'int',
    'not null' => TRUE,
    'default' => 0,
    'size' => 'tiny',
    'description' => 'Whether to use a permission to control access for using components.',
  ));
}

PS: It's fair to say that database updates are not required unless a change is made to the schema.

| improve this answer | |
  • I'm wanting an explanation as to how to when a code update also affects the database or not. And I want to make sure I'm doing it right. – Christia Jan 27 '18 at 8:51
  • 1
    So it's fair to say that database updates are not required unless a change is made to the schema? None of the updates involved install files. – Christia Jan 27 '18 at 8:56

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.