You are here

function rules_schema in Rules 6

Same name and namespace in other branches
  1. 7.2 rules.install \rules_schema()

Implementation of hook_schema.

File

rules/rules.install, line 35
Rules - Installation file.

Code

function rules_schema() {
  drupal_load('module', 'rules');

  // We define a table for each item type.
  $items = rules_get_items();
  foreach ($items as $name => $info) {
    $schema[$info['db_table']] = array(
      'fields' => array(
        'name' => array(
          'type' => 'varchar',
          'length' => '255',
          'not null' => TRUE,
          'default' => '',
          'description' => t('The name of the item.'),
        ),
        'data' => array(
          'type' => 'blob',
          'size' => 'big',
          'not null' => FALSE,
          'serialize' => TRUE,
          'description' => t('The whole, serialized item configuration.'),
        ),
      ),
      'primary key' => array(
        'name',
      ),
    );
  }
  $schema['cache_rules'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['cache_rules']['description'] = t('Cache table for the rules engine to store configured items.');
  return $schema;
}