You are here

function field_group_schema in Field Group 7

Same name and namespace in other branches
  1. 7.2 field_group.install \field_group_schema()

Implements hook_schema().

File

./field_group.install, line 11
Fieldgroup module install file.

Code

function field_group_schema() {
  $schema['field_group'] = array(
    'description' => t('Table that contains field group entries and settings.'),
    // CTools export definitions.
    'export' => array(
      'key' => 'identifier',
      'identifier' => 'field_group',
      'default hook' => 'field_group_info',
      'load callback' => 'field_group_group_load_by_identifier',
      'save callback' => 'field_group_group_save',
      'delete callback' => 'field_group_group_export_delete',
      'can disable' => TRUE,
      'api' => array(
        'owner' => 'field_group',
        'api' => 'field_group',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'The primary identifier for a group',
        'no export' => TRUE,
      ),
      'identifier' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The unique string identifier for a group.',
      ),
      'group_name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The name of this group.',
      ),
      'entity_type' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'bundle' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'mode' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      // @todo 'parent_name' is redundant with the data in the 'children'
      // entry, brings a risk of inconsistent data. This should be removed from
      // the schema and pre-computed it if needed in field_group_get_groups().
      'parent_name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The parent name for a group',
      ),
      'data' => array(
        'type' => 'blob',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
        'description' => 'Serialized data containing the group properties that do not warrant a dedicated column.',
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'indexes' => array(
      'group_name' => array(
        'group_name',
      ),
    ),
    'unique keys' => array(
      'identifier' => array(
        'identifier',
      ),
    ),
  );
  return $schema;
}