You are here

function update_test_schema_schema in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 13
Update hooks and schema definition for the update_test_schema module.

Code

function update_test_schema_schema() {
  $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,
  ];
}