uc_payment_pack.install 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the uc_payment_pack module.
  5. */
  6. /**
  7. * Implements hook_schema().
  8. */
  9. function uc_payment_pack_schema() {
  10. $schema = array();
  11. $schema['uc_payment_check'] = array(
  12. 'description' => 'Stores check payment information.',
  13. 'fields' => array(
  14. 'check_id' => array(
  15. 'description' => 'Primary key: the check ID.',
  16. 'type' => 'serial',
  17. 'unsigned' => TRUE,
  18. 'not null' => TRUE,
  19. ),
  20. 'order_id' => array(
  21. 'description' => 'The {uc_orders}.order_id.',
  22. 'type' => 'int',
  23. 'unsigned' => TRUE,
  24. 'not null' => TRUE,
  25. 'default' => 0,
  26. ),
  27. 'clear_date' => array(
  28. 'description' => 'The Unix timestamp indicating the expected clear date for the check.',
  29. 'type' => 'int',
  30. 'not null' => TRUE,
  31. 'default' => 0,
  32. ),
  33. ),
  34. 'indexes' => array(
  35. 'order_id' => array('order_id'),
  36. ),
  37. 'primary key' => array('check_id'),
  38. 'foreign keys' => array(
  39. 'uc_orders' => array(
  40. 'table' => 'uc_orders',
  41. 'columns' => array('order_id' => 'order_id'),
  42. ),
  43. ),
  44. );
  45. $schema['uc_payment_cod'] = array(
  46. 'description' => 'Stores COD payment information.',
  47. 'fields' => array(
  48. 'order_id' => array(
  49. 'description' => 'The {uc_orders}.order_id.',
  50. 'type' => 'int',
  51. 'unsigned' => TRUE,
  52. 'not null' => TRUE,
  53. 'default' => 0,
  54. ),
  55. 'delivery_month' => array(
  56. 'description' => 'The month of delivery. 1 => January, 2 => February, etc.',
  57. 'type' => 'int',
  58. 'size' => 'small',
  59. 'unsigned' => TRUE,
  60. 'not null' => TRUE,
  61. 'default' => 0,
  62. ),
  63. 'delivery_day' => array(
  64. 'description' => 'The day of the month of delivery.',
  65. 'type' => 'int',
  66. 'size' => 'small',
  67. 'unsigned' => TRUE,
  68. 'not null' => TRUE,
  69. 'default' => 0,
  70. ),
  71. 'delivery_year' => array(
  72. 'description' => 'The year of delivery.',
  73. 'type' => 'int',
  74. 'size' => 'small',
  75. 'unsigned' => TRUE,
  76. 'not null' => TRUE,
  77. 'default' => 0,
  78. ),
  79. ),
  80. 'primary key' => array('order_id'),
  81. 'foreign keys' => array(
  82. 'uc_orders' => array(
  83. 'table' => 'uc_orders',
  84. 'columns' => array('order_id' => 'order_id'),
  85. ),
  86. ),
  87. );
  88. $schema['uc_payment_other'] = array(
  89. 'description' => 'Stores Other payment type information.',
  90. 'fields' => array(
  91. 'order_id' => array(
  92. 'description' => 'The {uc_orders}.order_id.',
  93. 'type' => 'int',
  94. 'unsigned' => TRUE,
  95. 'not null' => TRUE,
  96. 'default' => 0,
  97. ),
  98. 'description' => array(
  99. 'description' => 'The description of the payment type.',
  100. 'type' => 'varchar',
  101. 'length' => 64,
  102. 'not null' => TRUE,
  103. 'default' => '',
  104. ),
  105. ),
  106. 'primary key' => array('order_id'),
  107. 'foreign keys' => array(
  108. 'uc_orders' => array(
  109. 'table' => 'uc_orders',
  110. 'columns' => array('order_id' => 'order_id'),
  111. ),
  112. ),
  113. );
  114. return $schema;
  115. }
  116. /**
  117. * Implements hook_uninstall().
  118. */
  119. function uc_payment_pack_uninstall() {
  120. db_delete('variable')
  121. ->condition(db_or()
  122. ->condition('name', 'uc_check_%', 'LIKE')
  123. ->condition('name', 'uc_cod_%', 'LIKE')
  124. )
  125. ->execute();
  126. }
  127. /**
  128. * Implements hook_update_last_removed().
  129. */
  130. function uc_payment_pack_update_last_removed() {
  131. return 6000;
  132. }