8.3.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.2.x schema.inc drupal_set_installed_schema_version($module, $version)
8.4.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.


$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


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


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

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


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.

 * 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.