You are here

function synonyms_schema in Synonyms 7

Implements hook_schema().

File

./synonyms.install, line 11
Install, update, and uninstall functions for the Synonyms module.

Code

function synonyms_schema() {
  $schema = array();
  $schema['synonyms_settings'] = array(
    'description' => 'Stores synonyms settings for all the entities and providers. Only enabled synonyms behavior implementations are included in this table.',
    'fields' => array(
      'entity_type' => array(
        'description' => 'Entity type whose behavior implementation is stored in this row.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ),
      'bundle' => array(
        'description' => 'Bundle name whose behavior implementation is stored in this row.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ),
      'provider' => array(
        'description' => 'Provider name whose behavior implementation is stored in this row.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'behavior' => array(
        'description' => 'Name of the synonyms behavior (ctools plugin), whose settings are stored in this row.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'settings_serialized' => array(
        'description' => 'Settings of the specified synonyms behavior for the specified field instance.',
        'type' => 'text',
        'serialize' => TRUE,
        'not null' => TRUE,
      ),
    ),
    'unique keys' => array(
      // We build 2 different indexes on the same column set because there are
      // 2 different functions that may query this table and the columns they
      // filter on may vary.
      'behavior_implementation' => array(
        'behavior',
        'entity_type',
        'bundle',
        'provider',
      ),
      'all_enabled' => array(
        'entity_type',
        'bundle',
        'provider',
        'behavior',
      ),
    ),
  );
  return $schema;
}