You are here

function customfilter_schema in Custom filter 7

Same name and namespace in other branches
  1. 6.2 customfilter.install \customfilter_schema()
  2. 6 customfilter.install \customfilter_schema()
  3. 7.2 customfilter.install \customfilter_schema()

Implements hook_schema().

File

./customfilter.install, line 11
Installation file for Custom filter.

Code

function customfilter_schema() {
  $schema['customfilter_filter'] = array(
    'description' => 'The table for filters.',
    'fields' => array(
      'fid' => array(
        'description' => 'The filter ID.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 1,
      ),
      'type' => array(
        'description' => 'The machine-readable name of this filter.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'name' => array(
        'description' => 'The human-readable name of this filter..',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'cache' => array(
        'description' => "A boolean value that is set when the filter result is cached.",
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
      'description' => array(
        'description' => 'The filter description.',
        'type' => 'text',
      ),
      'shorttip' => array(
        'description' => 'The short description shown in the node editing page.',
        'type' => 'text',
      ),
      'longtip' => array(
        'description' => 'The filter description shown in the filters description page.',
        'type' => 'text',
      ),
    ),
    'primary key' => array(
      'fid',
    ),
  );
  $schema['customfilter_rule'] = array(
    'description' => 'The table for the filter rules.',
    'fields' => array(
      'rid' => array(
        'description' => 'The rule ID',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
      'fid' => array(
        'description' => 'The ID of the filter containing the replacement rule.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'prid' => array(
        'description' => 'The parent rule.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'name' => array(
        'description' => 'The name of the replacement rule.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'description' => 'The description of the rule.',
        'type' => 'text',
      ),
      'enabled' => array(
        'description' => 'A boolean value that is set when the rule is enabled.',
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
      'matches' => array(
        'description' => 'The n-th matched string to replace.',
        'type' => 'int',
        'size' => 'small',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
      'pattern' => array(
        'description' => 'The regular expression.',
        'type' => 'text',
      ),
      'replacement' => array(
        'description' => 'The replacement text.',
        'type' => 'text',
      ),
      'code' => array(
        'description' => 'A boolean value that is set when the replacement text is PHP code to execute.',
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'weight' => array(
        'description' => 'The rule weight.',
        'type' => 'int',
        'size' => 'small',
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'customfilter_rule_fid' => array(
        'fid',
      ),
      'customfilter_rule_prid' => array(
        'prid',
      ),
      'customfilter_rule_weight' => array(
        'weight',
      ),
    ),
    'primary key' => array(
      'rid',
    ),
  );
  $schema['cache_customfilter'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['cache_customfilter']['description'] = 'Cache table for the Custom filter module to store information about the custom filter, and the replacement rules.';
  return $schema;
}