function field_schema

7.x field.install field_schema()

Implements hook_schema().

5 string references to 'field_schema'
field_create_field in drupal-7.x/modules/field/field.crud.inc
Creates a field.
field_read_fields in drupal-7.x/modules/field/field.crud.inc
Reads in fields that match an array of conditions.
field_update_7001 in drupal-7.x/modules/field/field.install
Fix fields definitions created during the d6 to d7 upgrade path.
field_update_field in drupal-7.x/modules/field/field.crud.inc
Updates a field.
_update_7000_field_create_field in drupal-7.x/modules/field/field.install
Utility function: create a field by writing directly to the database.

File

drupal-7.x/modules/field/field.install, line 11
Install, update and uninstall functions for the field module.

Code

function field_schema() {
  // Static (meta) tables.
  $schema['field_config'] = array(
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'The primary identifier for a field',
      ),
      'field_name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'description' => 'The name of this field. Non-deleted field names are unique, but multiple deleted fields can have the same name.',
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'description' => 'The type of this field.',
      ),
      'module' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The module that implements the field type.',
      ),
      'active' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Boolean indicating whether the module that implements the field type is enabled.',
      ),
      'storage_type' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'description' => 'The storage backend for the field.',
      ),
      'storage_module' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The module that implements the storage backend.',
      ),
      'storage_active' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Boolean indicating whether the module that implements the storage backend is enabled.',
      ),
      'locked' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
        'description' => '@TODO',
      ),
      'data' => array(
        'type' => 'blob',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
        'description' => 'Serialized data containing the field properties that do not warrant a dedicated column.',
      ),
      'cardinality' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'translatable' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'deleted' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array('id'),
    'indexes' => array(
      'field_name' => array('field_name'),
      // Used by field_sync_field_status().
      'active' => array('active'),
      'storage_active' => array('storage_active'),
      'deleted' => array('deleted'),
      // Used by field_modules_disabled().
      'module' => array('module'),
      'storage_module' => array('storage_module'),
      'type' => array('type'),
      'storage_type' => array('storage_type'),
    ),
  );
  $schema['field_config_instance'] = array(
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'The primary identifier for a field instance',
      ),
      'field_id' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'The identifier of the field attached by this instance',
      ),
      'field_name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => ''
      ),
      'entity_type' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => ''
      ),
      'bundle' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => ''
      ),
      'data' => array(
        'type' => 'blob',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
      ),
      'deleted' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array('id'),
    'indexes' => array(
      // Used by field_delete_instance().
      'field_name_bundle' => array('field_name', 'entity_type', 'bundle'),
      // Used by field_read_instances().
      'deleted' => array('deleted'),
    ),
  );
  $schema['cache_field'] = drupal_get_schema_unprocessed('system', 'cache');

  return $schema;
}