summaryrefslogtreecommitdiff
path: root/modules/trigger/trigger.install
blob: 981ad5dbf065d1e50c7ee7a7912dfcc3553c022e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
// $Id$

/**
 * Implementation of hook_install().
 */
function trigger_install() {
  // Create tables.
  drupal_install_schema('trigger');

  // Do initial synchronization of actions in code and the database.
  actions_synchronize(actions_list());
}

/**
 * Implementation of hook_uninstall().
 */
function trigger_uninstall() {
  // Remove tables.
  drupal_uninstall_schema('trigger');
}

/**
 * Implementation of hook_schema().
 */
function trigger_schema() {
  $schema['trigger_assignments'] = array(
    'description' => t('Maps trigger to hook and operation assignments from trigger.module.'),
    'fields' => array(
      'hook' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => t('Primary Key: The name of the internal Drupal hook upon which an action is firing; for example, nodeapi.'),
      ),
      'op' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => t('Primary Key: The specific operation of the hook upon which an action is firing: for example, presave.'),
      ),
      'aid' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => t("Primary Key: Action's {actions}.aid."),
      ),
      'weight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The weight of the trigger assignment in relation to other triggers.'),
      ),
    ),
    'primary key' => array('hook', 'op', 'aid'),
  );
  return $schema;
}