drupal-6.trigger.database.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. // Add several trigger configurations.
  37. db_insert('trigger_assignments')->fields(array(
  38. 'hook',
  39. 'op',
  40. 'aid',
  41. 'weight',
  42. ))
  43. ->values(array(
  44. 'hook' => 'node',
  45. 'op' => 'presave',
  46. 'aid' => 'node_publish_action',
  47. 'weight' => '1',
  48. ))
  49. ->values(array(
  50. 'hook' => 'comment',
  51. 'op' => 'presave',
  52. 'aid' => 'comment_publish_action',
  53. 'weight' => '1',
  54. ))
  55. ->values(array(
  56. 'hook' => 'comment_delete',
  57. 'op' => 'presave',
  58. 'aid' => 'node_save_action',
  59. 'weight' => '1',
  60. ))
  61. ->values(array(
  62. 'hook' => 'nodeapi',
  63. 'op' => 'presave',
  64. 'aid' => 'node_make_sticky_action',
  65. 'weight' => '1',
  66. ))
  67. ->values(array(
  68. 'hook' => 'nodeapi',
  69. 'op' => 'somehow_nodeapi_got_a_very_long',
  70. 'aid' => 'node_save_action',
  71. 'weight' => '1',
  72. ))
  73. ->execute();
  74. db_update('system')->fields(array(
  75. 'schema_version' => '6000',
  76. 'status' => '1',
  77. ))
  78. ->condition('filename', 'modules/trigger/trigger.module')
  79. ->execute();