You are here

function image_field_caption_schema in Image Field Caption 8

Same name and namespace in other branches
  1. 7.2 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 11
Install, update and uninstall functions for the image caption module.

Code

function image_field_caption_schema() {

  // Image Field Caption table.
  $schema['image_field_caption'] = array(
    'description' => 'The base table for the image_field_caption module.',
    'fields' => array(
      'entity_type' => array(
        'description' => 'The entity type attached to this caption',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'bundle' => array(
        'description' => 'The bundle attached to this caption',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'field_name' => array(
        'description' => 'The field name attached to this caption',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'entity_id' => array(
        'description' => 'The entity id attached to this caption',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'revision_id' => array(
        'description' => 'The entity id attached to this caption, or NULL if the entity type is not versioned',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
      'language' => array(
        'description' => 'The language attached to this caption',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'delta' => array(
        'description' => 'The sequence number for this caption, used for multi-value fields',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'caption' => array(
        'description' => 'The caption text.',
        'type' => 'text',
        'not null' => FALSE,
      ),
      'caption_format' => array(
        'description' => 'The caption format.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
    ),
    'indexes' => array(
      'entity_type' => array(
        'entity_type',
      ),
      'bundle' => array(
        'bundle',
      ),
      'entity_id' => array(
        'entity_id',
      ),
      'revision_id' => array(
        'revision_id',
      ),
      'language' => array(
        'language',
      ),
    ),
    'primary key' => array(
      'entity_type',
      'field_name',
      'entity_id',
      'language',
      'delta',
    ),
  );

  // Image Field Caption revision table.
  $schema['image_field_caption_revision'] = array(
    'description' => 'The revision table for the image_field_caption module.',
    'fields' => array(
      'entity_type' => array(
        'description' => 'The entity type attached to this caption',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'bundle' => array(
        'description' => 'The bundle attached to this caption',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'field_name' => array(
        'description' => 'The field name attached to this caption',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'entity_id' => array(
        'description' => 'The entity id attached to this caption',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'revision_id' => array(
        'description' => 'The entity id attached to this caption, or NULL if the entity type is not versioned',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'language' => array(
        'description' => 'The language attached to this caption',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'delta' => array(
        'description' => 'The sequence number for this caption, used for multi-value fields',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'caption' => array(
        'description' => 'The caption text.',
        'type' => 'text',
        'not null' => FALSE,
      ),
      'caption_format' => array(
        'description' => 'The caption format.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
    ),
    'indexes' => array(
      'entity_type' => array(
        'entity_type',
      ),
      'bundle' => array(
        'bundle',
      ),
      'entity_id' => array(
        'entity_id',
      ),
      'revision_id' => array(
        'revision_id',
      ),
      'language' => array(
        'language',
      ),
    ),
    'primary key' => array(
      'entity_type',
      'field_name',
      'entity_id',
      'revision_id',
      'language',
      'delta',
    ),
  );
  return $schema;
}