11

In my custom module's install file I have a hook_update_N function. Let's say it's mymodule_update_7100. However, I've noticed that I've done it wrong and I want to change a line of code within this function. Seeing as I've already run updb/update.php the changes won't be picked up and I'd have to rename it to either mymodule_update_7101 or create a new function after it with that name. I'd really rather not have to do this, so I was wondering if there's a variable that tells Drupal exactly what "version number" a module is currently at and whether I can reset it to trick it into allowing me to run the update script again.

The actual effect the function has had on the database isn't important because it's just generating a taxonomy term that I can easily delete through the front-end afterwards.

17

The schema_version column in the system table contains the version of the last successful update. Manipulate that value and you can re-test your update.

The name column is the machine name of the module, same as the info file is named.

This query will do the trick for you.

UPDATE system SET schema_version = XXXX WHERE name = 'name_of_module';
1

Drupal 7 core's install.inc has the function drupal_set_installed_schema_version($module, $version)

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.