Projet

Général

Profil

Paste
Télécharger (1,6 ko) Statistiques
| Branche: | Révision:

root / drupal7 / modules / simpletest / tests / upgrade / drupal-6.trigger.database.php @ f7a2490e

1
<?php
2
/**
3
 * @file
4
 * Test content for the trigger upgrade path.
5
 */
6
db_create_table('trigger_assignments', array(
7
  'fields' => array(
8
    'hook' => array(
9
      'type' => 'varchar',
10
      'length' => 32,
11
      'not null' => TRUE,
12
      'default' => '',
13
    ),
14
    'op' => array(
15
      'type' => 'varchar',
16
      'length' => 32,
17
      'not null' => TRUE,
18
      'default' => '',
19
    ),
20
    'aid' => array(
21
      'type' => 'varchar',
22
      'length' => 255,
23
      'not null' => TRUE,
24
      'default' => '',
25
    ),
26
    'weight' => array(
27
      'type' => 'int',
28
      'not null' => TRUE,
29
      'default' => 0,
30
    ),
31
  ),
32
  'primary key' => array('hook', 'op', 'aid'),
33
  'module' => 'trigger',
34
  'name' => 'trigger_assignments',
35
));
36

    
37

    
38
// Add several trigger configurations.
39
db_insert('trigger_assignments')->fields(array(
40
  'hook',
41
  'op',
42
  'aid',
43
  'weight',
44
))
45
->values(array(
46
  'hook' => 'node',
47
  'op' => 'presave',
48
  'aid' => 'node_publish_action',
49
  'weight' => '1',
50
))
51
->values(array(
52
  'hook' => 'comment',
53
  'op' => 'presave',
54
  'aid' => 'comment_publish_action',
55
  'weight' => '1',
56
))
57
->values(array(
58
  'hook' => 'comment_delete',
59
  'op' => 'presave',
60
  'aid' => 'node_save_action',
61
  'weight' => '1',
62
))
63
->values(array(
64
  'hook' => 'nodeapi',
65
  'op' => 'presave',
66
  'aid' => 'node_make_sticky_action',
67
  'weight' => '1',
68
))
69
->values(array(
70
  'hook' => 'nodeapi',
71
  'op' => 'somehow_nodeapi_got_a_very_long',
72
  'aid' => 'node_save_action',
73
  'weight' => '1',
74
))
75
->execute();
76

    
77
db_update('system')->fields(array(
78
  'schema_version' => '6000',
79
  'status' => '1',
80
))
81
->condition('filename', 'modules/trigger/trigger.module')
82
->execute();