You are here

function image_field_caption_schema in Image Field Caption 7.2

Same name and namespace in other branches
  1. 8 image_field_caption.install \image_field_caption_schema()
  2. 7 image_field_caption.install \image_field_caption_schema()

Implements hook_schema().

File

./image_field_caption.install, line 12
Image field caption defines a new database schema for adding a caption to images.

Code

function image_field_caption_schema() {
  $schema['field_image_field_caption'] = array(
    'description' => 'The base table for the image_field_caption module.',
    'fields' => array(
      'field_name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'entity_type' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The entity type this data is attached to',
      ),
      'bundle' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The field instance bundle to which this row belongs, used when deleting a field instance',
      ),
      'entity_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The entity id this data is attached to',
      ),
      'revision_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
        'description' => 'The entity revision id this data is attached to, or NULL if the entity type is not versioned',
      ),
      // @todo Consider storing language as integer.
      'language' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The language for this data item.',
      ),
      'delta' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The sequence number for this data item, used for multi-value fields',
      ),
      'caption' => array(
        'description' => 'The caption text.',
        'type' => 'text',
        'not null' => FALSE,
      ),
      'caption_format' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'field_name',
      'entity_type',
      'entity_id',
      'delta',
      'language',
    ),
    'indexes' => array(
      'entity_type' => array(
        'entity_type',
      ),
      'bundle' => array(
        'bundle',
      ),
      'entity_id' => array(
        'entity_id',
      ),
      'revision_id' => array(
        'revision_id',
      ),
      'language' => array(
        'language',
      ),
    ),
  );
  $schema['field_image_field_caption_revision'] = array(
    'description' => 'The base table for the image_field_caption module.',
    'fields' => array(
      'field_name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'entity_type' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The entity type this data is attached to',
      ),
      'bundle' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The field instance bundle to which this row belongs, used when deleting a field instance',
      ),
      'entity_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The entity id this data is attached to',
      ),
      'revision_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The entity revision id this data is attached to',
      ),
      // @todo Consider storing language as integer.
      'language' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The language for this data item.',
      ),
      'delta' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The sequence number for this data item, used for multi-value fields',
      ),
      'caption' => array(
        'description' => 'The caption text.',
        'type' => 'text',
        'not null' => FALSE,
      ),
      'caption_format' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'field_name',
      'entity_type',
      'entity_id',
      'revision_id',
      'delta',
      'language',
    ),
    'indexes' => array(
      'entity_type' => array(
        'entity_type',
      ),
      'bundle' => array(
        'bundle',
      ),
      'entity_id' => array(
        'entity_id',
      ),
      'revision_id' => array(
        'revision_id',
      ),
      'language' => array(
        'language',
      ),
    ),
  );
  return $schema;
}