You are here

function field_validation_schema in Field Validation 7

Same name and namespace in other branches
  1. 7.2 field_validation.install \field_validation_schema()

Implements hook_schema().

File

./field_validation.install, line 11
field_validation installation file

Code

function field_validation_schema() {
  $schema['field_validation_rule'] = array(
    'description' => 'Stores rule definitions',
    'export' => array(
      'key' => 'name',
      'key name' => 'Name',
      'primary key' => 'ruleid',
      'identifier' => 'rule',
      'default hook' => 'default_field_validation_rule',
      'api' => array(
        'owner' => 'field_validation',
        'api' => 'default_field_validation_rules',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'ruleid' => array(
        'type' => 'serial',
        'description' => 'Unique identifier of the validation rule',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'no export' => TRUE,
      ),
      'rulename' => array(
        'type' => 'varchar',
        'description' => 'Name of the validation rule',
        'not null' => TRUE,
        'default' => '',
        'length' => 255,
      ),
      'name' => array(
        'type' => 'varchar',
        'description' => 'Machine name of the validation rule',
        'not null' => TRUE,
        'default' => '',
        'length' => 32,
      ),
      'field_name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'col' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => 'value',
      ),
      'entity_type' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'bundle' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'validator' => array(
        'type' => 'varchar',
        'description' => 'The validator key',
        'not null' => TRUE,
        'default' => '',
        'length' => 255,
      ),
      'data' => array(
        'type' => 'varchar',
        'description' => 'Additional rule data',
        'not null' => FALSE,
        'length' => 255,
      ),
      'error_message' => array(
        'type' => 'varchar',
        'description' => 'Rule error message',
        'not null' => FALSE,
        'length' => 255,
      ),
    ),
    'primary key' => array(
      'ruleid',
    ),
    'indexes' => array(
      'field_name_bundle' => array(
        'field_name',
        'entity_type',
        'bundle',
      ),
    ),
  );
  return $schema;
}