ajax_example.install 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * @file
  4. * AJAX Examples install file schema for ajax_example_form_node_form_alter()
  5. */
  6. /**
  7. * Implements hook_schema().
  8. */
  9. function ajax_example_schema() {
  10. $schema['ajax_example_node_form_alter'] = array(
  11. 'description' => 'Stores example settings for nodes.',
  12. 'fields' => array(
  13. 'nid' => array(
  14. 'type' => 'int',
  15. 'unsigned' => TRUE,
  16. 'not null' => TRUE,
  17. 'default' => 0,
  18. 'description' => 'The {node}.nid to store settings.',
  19. ),
  20. 'example_1' => array(
  21. 'type' => 'int',
  22. 'not null' => TRUE,
  23. 'default' => 0,
  24. 'description' => 'Node Form Example 1 checkbox',
  25. ),
  26. 'example_2' => array(
  27. 'type' => 'varchar',
  28. 'length' => 256,
  29. 'not null' => FALSE,
  30. 'default' => '',
  31. 'description' => 'Node Form Example 2 textfield',
  32. ),
  33. ),
  34. 'primary key' => array('nid'),
  35. 'foreign keys' => array(
  36. 'dnv_node' => array(
  37. 'table' => 'node',
  38. 'columns' => array('nid' => 'nid'),
  39. ),
  40. ),
  41. );
  42. return $schema;
  43. }
  44. /**
  45. * Add the new ajax_example_node_form_alter table.
  46. */
  47. function ajax_example_update_7100() {
  48. if (!db_table_exists('ajax_example_node_form_alter')) {
  49. $schema = ajax_example_schema();
  50. db_create_table('ajax_example_node_form_alter', $schema['ajax_example_node_form_alter']);
  51. return st('Created table ajax_example_node_form_alter');
  52. }
  53. }