field_example.install 847 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * @file
  4. * Install, update, and uninstall functions for the field_example module.
  5. */
  6. /**
  7. * Implements hook_field_schema().
  8. *
  9. * Defines the database schema of the field, using the format used by the
  10. * Schema API.
  11. *
  12. * The data we will store here is just one 7-character element, even
  13. * though the widget presents the three portions separately.
  14. *
  15. * All implementations of hook_field_schema() must be in the module's
  16. * .install file.
  17. *
  18. * @see http://drupal.org/node/146939
  19. * @see schemaapi
  20. * @see hook_field_schema()
  21. * @ingroup field_example
  22. */
  23. function field_example_field_schema($field) {
  24. $columns = array(
  25. 'rgb' => array('type' => 'varchar', 'length' => 7, 'not null' => FALSE),
  26. );
  27. $indexes = array(
  28. 'rgb' => array('rgb'),
  29. );
  30. return array(
  31. 'columns' => $columns,
  32. 'indexes' => $indexes,
  33. );
  34. }