number.install

Install, update and uninstall functions for the number module.

File

drupal-7.x/modules/field/modules/number/number.install
View source
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the number module.
  5. */
  6. /**
  7. * Implements hook_field_schema().
  8. */
  9. function number_field_schema($field) {
  10. switch ($field['type']) {
  11. case 'number_integer' :
  12. $columns = array(
  13. 'value' => array(
  14. 'type' => 'int',
  15. 'not null' => FALSE
  16. ),
  17. );
  18. break;
  19. case 'number_float' :
  20. $columns = array(
  21. 'value' => array(
  22. 'type' => 'float',
  23. 'not null' => FALSE
  24. ),
  25. );
  26. break;
  27. case 'number_decimal' :
  28. $columns = array(
  29. 'value' => array(
  30. 'type' => 'numeric',
  31. 'precision' => $field['settings']['precision'],
  32. 'scale' => $field['settings']['scale'],
  33. 'not null' => FALSE
  34. ),
  35. );
  36. break;
  37. }
  38. return array(
  39. 'columns' => $columns,
  40. );
  41. }