8.2.x schema.inc drupal_set_installed_schema_version($module, $version)
8.0.x schema.inc drupal_set_installed_schema_version($module, $version)
8.1.x schema.inc drupal_set_installed_schema_version($module, $version)
8.3.x schema.inc drupal_set_installed_schema_version($module, $version)
4.7.x install.inc drupal_set_installed_schema_version($module, $version)
5.x install.inc drupal_set_installed_schema_version($module, $version)
6.x install.inc drupal_set_installed_schema_version($module, $version)
7.x install.inc drupal_set_installed_schema_version($module, $version)

Update the installed version information for a module.

Parameters

$module: A module name.

$version: The new schema version.

7 calls to drupal_set_installed_schema_version()
drupal_uninstall_modules in includes/install.inc
Uninstalls a given list of disabled modules.
module_enable in includes/module.inc
Enables or installs a given list of modules.
system_install in modules/system/system.install
Implements hook_install().
UpdateScriptFunctionalTest::testRequirements in modules/system/system.test
Tests that requirements warnings and errors are correctly displayed.
UpdateScriptFunctionalTest::testSuccessfulUpdateFunctionality in modules/system/system.test
Tests update.php after performing a successful update.

... See full list

File

includes/install.inc, line 177
API functions for installing modules and themes.

Code

function drupal_set_installed_schema_version($module, $version) {
  db_update('system')
    ->fields(array('schema_version' => $version))
    ->condition('name', $module)
    ->execute();

  // Reset the static cache of module schema versions.
  drupal_get_installed_schema_version(NULL, TRUE);
}

Comments

patkai’s picture

Good to know the meaning of schema_version, if you ever look at the system table in the database:

/**
 * Indicates that a module has not been installed yet.
 */
define('SCHEMA_UNINSTALLED', -1);

/**
 * Indicates that a module has been installed.
 */
define('SCHEMA_INSTALLED', 0);

In case the version number is e.g 7004 it means a schema installed during one of the module updates.