5 * Update hooks and schema definition for the update_test_schema module.
9 * Implements hook_schema().
11 * The schema defined here will vary on state to allow for update hook testing.
13 function update_test_schema_schema() {
14 $schema_version = \Drupal::state()->get('update_test_schema_version', 8000);
17 'a' => ['type' => 'int', 'not null' => TRUE],
18 'b' => ['type' => 'blob', 'not null' => FALSE],
21 switch ($schema_version) {
24 $table['indexes']['test'] = ['a'];
27 return ['update_test_schema_table' => $table];
30 // Update hooks are defined depending on state as well.
31 $schema_version = \Drupal::state()->get('update_test_schema_version', 8000);
33 if ($schema_version >= 8001) {
35 * Schema version 8001.
37 function update_test_schema_update_8001() {
40 'a' => ['type' => 'int', 'not null' => TRUE],
41 'b' => ['type' => 'blob', 'not null' => FALSE],
46 db_add_index('update_test_schema_table', 'test', ['a'], $table);