uc_webform.install 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * @file
  4. * Contains install and update functions for uc_webform.
  5. */
  6. /**
  7. * Implementation of hook_field_schema.
  8. */
  9. function uc_webform_schema() {
  10. $schema = array(
  11. 'uc_webform' => array(
  12. 'fields' => array(
  13. 'nid' => array(
  14. 'type' => 'int',
  15. 'unsigned' => TRUE,
  16. 'not null' => TRUE,
  17. ),
  18. 'webform_nid' => array(
  19. 'type' => 'int',
  20. 'unsigned' => TRUE,
  21. 'not null' => FALSE,
  22. 'default' => 0,
  23. ),
  24. 'submit' => array(
  25. 'type' => 'int',
  26. 'size' => 'tiny',
  27. 'unsigned' => TRUE,
  28. 'not null' => TRUE,
  29. 'default' => 0,
  30. ),
  31. ),
  32. 'primary key' => array('nid'),
  33. ),
  34. 'uc_webform_submission' => array(
  35. 'fields' => array(
  36. 'sid' => array(
  37. 'type' => 'int',
  38. 'unsigned' => TRUE,
  39. 'not null' => TRUE,
  40. ),
  41. 'order_id' => array(
  42. 'type' => 'int',
  43. 'unsigned' => TRUE,
  44. ),
  45. ),
  46. ),
  47. );
  48. return $schema;
  49. }
  50. function uc_webform_update_7000() {
  51. $schema = uc_webform_schema();
  52. db_create_table('uc_webform_submission', $schema['uc_webform_submission']);
  53. }
  54. function uc_webform_update_7010() {
  55. $schema = uc_webform_schema();
  56. db_add_field('uc_webform', 'submit', $schema['uc_webform']['fields']['submit']);
  57. }
  58. function uc_webform_update_7020() {
  59. $schema = uc_webform_schema();
  60. db_change_field('uc_webform', 'webform_nid', 'webform_nid', $schema['uc_webform']['fields']['webform_nid']);
  61. }