uc_flatrate.install 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the uc_flatrate module.
  5. */
  6. /**
  7. * Implements hook_schema().
  8. */
  9. function uc_flatrate_schema() {
  10. $schema = array();
  11. $schema['uc_flatrate_products'] = array(
  12. 'description' => 'Stores product information for quantity-based shipping quotes methods.',
  13. 'fields' => array(
  14. 'vid' => array(
  15. 'description' => 'The {uc_products}.vid.',
  16. 'type' => 'int',
  17. 'unsigned' => TRUE,
  18. 'not null' => TRUE,
  19. 'default' => 0,
  20. ),
  21. 'nid' => array(
  22. 'description' => 'The {uc_products}.nid.',
  23. 'type' => 'int',
  24. 'unsigned' => TRUE,
  25. 'not null' => TRUE,
  26. 'default' => 0,
  27. ),
  28. 'mid' => array(
  29. 'description' => 'The {uc_flatrate_methods}.mid.',
  30. 'type' => 'int',
  31. 'unsigned' => TRUE,
  32. 'not null' => TRUE,
  33. 'default' => 0,
  34. ),
  35. 'rate' => array(
  36. 'description' => 'The rate multiplier, in the store default currency, per each of this product in the shipment.',
  37. 'type' => 'numeric',
  38. 'precision' => 16,
  39. 'scale' => 5,
  40. 'not null' => FALSE,
  41. ),
  42. ),
  43. 'primary key' => array('vid', 'mid'),
  44. 'foreign keys' => array(
  45. 'uc_products' => array(
  46. 'table' => 'uc_products',
  47. 'columns' => array(
  48. 'nid' => 'nid',
  49. 'vid' => 'vid',
  50. ),
  51. ),
  52. 'uc_flatrate_methods' => array(
  53. 'table' => 'uc_flatrate_methods',
  54. 'columns' => array('mid' => 'mid'),
  55. ),
  56. ),
  57. );
  58. $schema['uc_flatrate_methods'] = array(
  59. 'description' => 'Stores quantity-based shipping quotes method information.',
  60. 'fields' => array(
  61. 'mid' => array(
  62. 'description' => 'Primary key: The shipping quote method ID.',
  63. 'type' => 'serial',
  64. 'unsigned' => TRUE,
  65. 'not null' => TRUE,
  66. ),
  67. 'title' => array(
  68. 'description' => 'The method title, displayed on administration pages.',
  69. 'type' => 'varchar',
  70. 'length' => 255,
  71. 'not null' => TRUE,
  72. 'default' => '',
  73. ),
  74. 'label' => array(
  75. 'description' => 'The user-facing label of the shipping method.',
  76. 'type' => 'varchar',
  77. 'length' => 255,
  78. 'not null' => TRUE,
  79. 'default' => '',
  80. ),
  81. 'base_rate' => array(
  82. 'description' => 'The amount of shipping cost before product quantity is applied.',
  83. 'type' => 'numeric',
  84. 'precision' => 16,
  85. 'scale' => 5,
  86. 'not null' => TRUE,
  87. 'default' => 0.0,
  88. ),
  89. 'product_rate' => array(
  90. 'description' => 'The default rate multiplier, in the store default currency, per product in the shipment.',
  91. 'type' => 'numeric',
  92. 'precision' => 16,
  93. 'scale' => 5,
  94. 'not null' => TRUE,
  95. 'default' => 0.0,
  96. ),
  97. ),
  98. 'primary key' => array('mid'),
  99. );
  100. return $schema;
  101. }
  102. /**
  103. * Implements hook_update_last_removed().
  104. */
  105. function uc_flatrate_update_last_removed() {
  106. return 6003;
  107. }