You are here

function update_set_schema in Drupal 8

Same name and namespace in other branches
  1. 9 core/includes/update.inc \update_set_schema()

Forces a module to a given schema version.

This function is rarely necessary.

Parameters

string $module: Name of the module.

string $schema_version: The schema version the module should be set to.

1 call to update_set_schema()
UpdateSchemaTest::testUpdateHooks in core/modules/system/tests/src/Functional/UpdateSystem/UpdateSchemaTest.php
Tests that update hooks are properly run.

File

core/includes/update.inc, line 180
Drupal database update API.

Code

function update_set_schema($module, $schema_version) {
  \Drupal::keyValue('system.schema')
    ->set($module, $schema_version);
  \Drupal::service('extension.list.profile')
    ->reset();
  \Drupal::service('extension.list.module')
    ->reset();
  \Drupal::service('extension.list.theme_engine')
    ->reset();
  \Drupal::service('extension.list.theme')
    ->reset();
  drupal_static_reset('drupal_get_installed_schema_version');
}