You are here

function webform_validation_schema in Webform Validation 6

Same name and namespace in other branches
  1. 7 webform_validation.install \webform_validation_schema()

Implementation of hook_schema().

File

./webform_validation.install, line 25
webform_validation installation file

Code

function webform_validation_schema() {
  $schema['webform_validation_rule'] = array(
    'description' => 'Stores rule definitions',
    'fields' => array(
      'ruleid' => array(
        'type' => 'serial',
        'description' => 'Unique identifier for a rule',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'rulename' => array(
        'type' => 'varchar',
        'description' => 'Name for the rule',
        'not null' => TRUE,
        'default' => '',
        'length' => 255,
      ),
      'nid' => array(
        'type' => 'int',
        'description' => 'The webform {node}.nid',
        'not null' => TRUE,
        'default' => 0,
        'unsigned' => TRUE,
      ),
      '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(
      'nid' => array(
        'nid',
      ),
    ),
  );
  $schema['webform_validation_rule_components'] = array(
    'description' => 'Stores components linked to a rule',
    'fields' => array(
      'ruleid' => array(
        'type' => 'int',
        'description' => 'Unique identifier for a rule',
        'not null' => TRUE,
        'default' => 0,
        'unsigned' => TRUE,
      ),
      'cid' => array(
        'type' => 'int',
        'description' => 'The webform component id',
        'not null' => TRUE,
        'default' => 0,
        'unsigned' => TRUE,
      ),
    ),
    'primary key' => array(
      'ruleid',
      'cid',
    ),
  );
  return $schema;
}