You are here

function metatag_schema in Metatag 7

Implements hook_schema().

File

./metatag.install, line 247
Install, update, and uninstall functions for the metatag module.

Code

function metatag_schema() {
  $schema['metatag_config'] = array(
    'description' => 'Storage of meta tag configuration and defaults.',
    'export' => array(
      'key' => 'instance',
      'key name' => 'Instance',
      'primary key' => 'cid',
      'identifier' => 'config',
      'default hook' => 'metatag_config_default',
      'api' => array(
        'owner' => 'metatag',
        'api' => 'metatag',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
      'cache defaults' => TRUE,
      'default cache bin' => 'cache_metatag',
    ),
    'fields' => array(
      'cid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The primary identifier for a metatag configuration set.',
        'no export' => TRUE,
      ),
      'instance' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The machine-name of the configuration, typically entity-type:bundle.',
      ),
      'config' => array(
        'type' => 'blob',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
        'description' => 'Serialized data containing the meta tag configuration.',
        'translatable' => TRUE,
      ),
    ),
    'primary key' => array(
      'cid',
    ),
    'unique keys' => array(
      'instance' => array(
        'instance',
      ),
    ),
  );
  $schema['metatag'] = array(
    'fields' => array(
      'entity_type' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The entity type this data is attached to.',
      ),
      'entity_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The entity id this data is attached to.',
      ),
      'revision_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The revision_id for the entity object this data is attached to.',
      ),
      'language' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The language of the tag.',
      ),
      'data' => array(
        'type' => 'blob',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
      ),
    ),
    'indexes' => array(
      'type_revision' => array(
        'entity_type',
        'revision_id',
      ),
    ),
    'primary key' => array(
      'entity_type',
      'entity_id',
      'revision_id',
      'language',
    ),
  );
  $schema['cache_metatag'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['cache_metatag']['description'] = 'Cache table for the generated meta tag output.';
  return $schema;
}