Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. $schema = $cached->data;
  2.  
  3. <?php
  4. // $Id: my_module.install,v 1.00.0.1 2012/10/21 00:23:32 Exp $
  5.  
  6. /**
  7. * Implementation of hook_schema().
  8. */
  9. function my_module_schema() {
  10. $schema = array();
  11. $schema['my_module_pending_inserts'] = array(
  12. 'fields' => array(
  13. 'id' => array(
  14. 'description' => 'primary key',
  15. 'type' => 'serial',
  16. 'size' => 'tiny',
  17. 'not null' => TRUE,
  18. ),
  19. 'json_array_data' => array(
  20. 'type' => 'text',
  21. 'not null' => TRUE,
  22. ),
  23. 'successfully_run' => array(
  24. 'type' => 'int',
  25. 'not null' => TRUE,
  26. 'default' => 0,
  27. ),
  28. 'date_created' => array(
  29. 'type' => 'int',
  30. 'not null' => TRUE,
  31. 'default' => 0,
  32. ),
  33. 'date_updated' => array(
  34. 'type' => 'int',
  35. 'not null' => TRUE,
  36. 'default' => 0,
  37. )
  38.  
  39. ),
  40. 'primary key' => array('id'),
  41. );
  42. return $schema;
  43. }
  44.  
  45. function jira_reporting_install() {
  46. // Create tables.
  47. drupal_install_schema('my_module_pending_inserts');
  48. }
  49.  
  50. function my_module_uninstall() {
  51. // Remove tables.
  52. drupal_uninstall_schema('my_module_pending_inserts');
  53.  
  54. // Delete variables
  55. variable_del('my_module_variable1');
  56. variable_del('my_module_variable2');
  57. variable_del('my_module_variable3');
  58.  
  59. }
  60.  
  61. function my_module_update_2() {
  62. $up = array();
  63. $tbl = array(
  64. 'fields' => array(
  65. 'id' => array(
  66. 'type' => 'serial', 'not null' => TRUE
  67. ),
  68. 'json_array_data' => array(
  69. 'type' => 'varchar',
  70. 'length' => 250,
  71. 'not null' => True
  72. ),
  73. 'successfully_run' => array(
  74. 'type' => 'int'
  75. ),
  76. 'date_created' => array(
  77. 'type' => 'int'
  78. ),
  79. 'date_updated' => array(
  80. 'type' => 'int'
  81. ),
  82. ),
  83. 'primary key' => array('id'),
  84. );
  85.  
  86.  
  87. db_create_table(&$up, 'my_module_pending_inserts', $tbl);
  88. return $up;
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement