function update_test_schema_schema
Same name in other branches
- 9 core/modules/system/tests/modules/update_test_schema/update_test_schema.install \update_test_schema_schema()
- 8.9.x core/modules/system/tests/modules/update_test_schema/update_test_schema.install \update_test_schema_schema()
- 10 core/modules/system/tests/modules/update_test_schema/update_test_schema.install \update_test_schema_schema()
Implements hook_schema().
The schema defined here will vary on state to allow for update hook testing.
File
-
core/
modules/ system/ tests/ modules/ update_test_schema/ update_test_schema.install, line 38
Code
function update_test_schema_schema() : array {
$schema_version = \Drupal::state()->get('update_test_schema_version', 8000);
$table = [
'fields' => [
'a' => [
'type' => 'int',
'not null' => TRUE,
],
'b' => [
'type' => 'blob',
'not null' => FALSE,
],
],
];
switch ($schema_version) {
case 8001:
// Add the index.
$table['indexes']['test'] = [
'a',
];
break;
}
return [
'update_test_schema_table' => $table,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.