function trigger_schema

You are here

7 trigger.install trigger_schema()
6 trigger.install trigger_schema()

Implements hook_schema().

File

modules/trigger/trigger.install, line 11
Install, update and uninstall functions for the trigger module.

Code

function trigger_schema() {
  // The total index length (hook and aid) must be less than 333. Since the aid
  // field is 255 characters, the hook field can have a maximum length of 78.
  $schema['trigger_assignments'] = array(
    'description' => 'Maps trigger to hook and operation assignments from trigger.module.',
    'fields' => array(
      'hook' => array(
        'type' => 'varchar',
        'length' => 78,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Primary Key: The name of the internal Drupal hook; for example, node_insert.',
      ),
      'aid' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => "Primary Key: Action's {actions}.aid.",
      ),
      'weight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The weight of the trigger assignment in relation to other triggers.',
      ),
    ),
    'primary key' => array('hook', 'aid'),
    'foreign keys' => array(
      'action' => array(
        'table' => 'actions',
        'columns' => array('aid' => 'aid'),
      ),
    ),
  );
  return $schema;
}