uc_coupon_purchase.install 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the uc_coupon_purchase module.
  5. *
  6. */
  7. /**
  8. * Implements hook_schema()
  9. */
  10. function uc_coupon_purchase_schema() {
  11. $schema = array();
  12. $schema['uc_coupon_purchase'] = array(
  13. 'description' => 'Ubercart Purchased Coupons',
  14. 'fields' => array(
  15. 'pfid' => array(
  16. 'description' => 'The product feature id.',
  17. 'type' => 'serial',
  18. 'unsigned' => TRUE,
  19. 'not null' => TRUE,
  20. ),
  21. 'nid' => array(
  22. 'description' => 'The identifier of the node that has a feature.',
  23. 'type' => 'int',
  24. 'unsigned' => TRUE,
  25. 'not null' => TRUE,
  26. 'default' => 0,
  27. ),
  28. 'model' => array(
  29. 'description' => 'The SKU of the product that has a feature.',
  30. 'type' => 'varchar',
  31. 'length' => 30,
  32. 'not null' => TRUE,
  33. 'default' => '',
  34. ),
  35. 'base_cid' => array(
  36. 'description' => 'The base coupon ID to use when purchasing this feature.',
  37. 'type' => 'int',
  38. 'unsigned' => TRUE,
  39. 'not null' => TRUE,
  40. 'default' => 0,
  41. ),
  42. ),
  43. 'indexes' => array(
  44. 'nid' => array('nid'),
  45. 'model' => array('model'),
  46. ),
  47. 'primary key' => array('pfid'),
  48. );
  49. $schema['uc_coupon_purchase_users'] = array(
  50. 'description' => 'Ubercart Purchased Coupons Per Purchaser',
  51. 'fields' => array(
  52. 'cpuid' => array(
  53. 'type' => 'serial',
  54. 'unsigned' => TRUE,
  55. 'not null' => TRUE,
  56. ),
  57. 'uid' => array(
  58. 'description' => 'The user id.',
  59. 'type' => 'int',
  60. 'unsigned' => TRUE,
  61. 'not null' => TRUE,
  62. ),
  63. 'cid' => array(
  64. 'description' => 'The coupon id.',
  65. 'type' => 'int',
  66. 'unsigned' => TRUE,
  67. 'not null' => TRUE,
  68. ),
  69. ),
  70. 'primary key' => array('cpuid'),
  71. );
  72. return $schema;
  73. }
  74. /**
  75. * Implements hook_uninstall().
  76. */
  77. function uc_coupon_purchase_uninstall() {
  78. variable_del('uc_coupon_purchase_order_status');
  79. }
  80. /**
  81. * Implements hook_update_last_removed().
  82. */
  83. function uc_coupon_purchase_update_last_removed() {
  84. return 6000;
  85. }