You are here

function fc_schema in Field Complete 7

Implements hook_schema().

File

./fc.install, line 32
Field Complete - Provides field-based completeness for any entity - install.

Code

function fc_schema() {
  return array(
    'fc' => array(
      'description' => 'Stores the completeness of entities.',
      'fields' => array(
        'entity_type' => array(
          'type' => 'varchar',
          'length' => 128,
          'not null' => TRUE,
          'default' => '',
          'description' => 'The entity type this field complete data is attached to.',
        ),
        '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.',
        ),
        'complete' => array(
          'type' => 'int',
          'size' => 'tiny',
          'unsigned' => TRUE,
          'not null' => TRUE,
          'default' => 1,
          'description' => 'The completeness of this entity as a boolean, true or false.',
        ),
        'percentage' => array(
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
          'default' => 100,
          'description' => 'The completeness of this entity as a percentage scale from 0 to 100.',
        ),
        'completeness' => array(
          'type' => 'blob',
          'size' => 'big',
          'not null' => FALSE,
          'serialize' => TRUE,
          'description' => 'The individual completeness of the fields of this entity.',
        ),
      ),
      'primary key' => array(
        'entity_type',
        'entity_id',
        'revision_id',
      ),
      'indexes' => array(
        'entity_type' => array(
          'entity_type',
        ),
        'entity_id' => array(
          'entity_id',
        ),
        'revision_id' => array(
          'revision_id',
        ),
        'complete' => array(
          'complete',
        ),
        'percentage' => array(
          'percentage',
        ),
      ),
    ),
  );
}