uc_cart_links.install 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the uc_cart_links module.
  5. */
  6. /**
  7. * Implements hook_schema().
  8. */
  9. function uc_cart_links_schema() {
  10. $schema['uc_cart_link_clicks'] = array(
  11. 'description' => 'Stores information for cart links.',
  12. 'fields' => array(
  13. 'cart_link_id' => array(
  14. 'description' => 'The cart link identifier.',
  15. 'type' => 'varchar',
  16. 'length' => 32,
  17. 'not null' => TRUE,
  18. 'default' => '0',
  19. ),
  20. 'clicks' => array(
  21. 'description' => 'The number of times this cart link was clicked.',
  22. 'type' => 'int',
  23. 'not null' => TRUE,
  24. 'default' => 0,
  25. ),
  26. 'last_click' => array(
  27. 'description' => 'The time of the last click on this cart link, stored as a UNIX timestamp.',
  28. 'type' => 'int',
  29. 'not null' => TRUE,
  30. 'default' => 0,
  31. ),
  32. ),
  33. 'primary key' => array(
  34. 'cart_link_id',
  35. ),
  36. );
  37. return $schema;
  38. }
  39. /**
  40. * Implements hook_uninstall().
  41. */
  42. function uc_cart_links_uninstall() {
  43. db_delete('variable')
  44. ->condition('name', 'uc_cart_links_%', 'LIKE')
  45. ->execute();
  46. cache_clear_all('variables', 'cache_bootstrap');
  47. }
  48. /**
  49. * Implements hook_update_last_removed().
  50. */
  51. function uc_cart_links_update_last_removed() {
  52. return 6001;
  53. }