You are here

function uuid_schema_alter in Universally Unique IDentifier 7

Implements hook_schema_alter().

File

./uuid.install, line 34
Install, update and uninstall functions for the uuid module.

Code

function uuid_schema_alter(array &$schema) {
  $field_info = uuid_schema_field_definition();
  $key_names = array(
    'base table' => 'uuid',
    'revision table' => 'revision uuid',
  );
  foreach (uuid_get_core_entity_info() as $entity_info) {
    foreach ($key_names as $table_type => $key_name) {
      if (isset($entity_info[$table_type], $entity_info['entity keys'][$key_name])) {
        $field_name = $entity_info['entity keys'][$key_name];
        $properties = array(
          'fields' => $field_info,
          'indexes' => array(
            $field_name,
          ),
        );
        foreach ($properties as $property => $value) {
          $schema[$entity_info[$table_type]][$property][$field_name] = $value;
        }
      }
    }
  }
}