tripal_ds.install 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * @file
  4. * Fieldgroup module install file.
  5. */
  6. /**
  7. * Implements hook_schema().
  8. */
  9. function tripal_ds_schema() {
  10. $schema['tripal_ds'] = array(
  11. 'description' => t('Table that contains the Tripal Pane fieldsets.'),
  12. 'fields' => array(
  13. 'id' => array(
  14. 'type' => 'serial',
  15. 'not null' => TRUE,
  16. 'description' => 'The primary identifier for a group',
  17. 'no export' => TRUE,
  18. ),
  19. 'tripal_ds_field_label' => array(
  20. 'type' => 'varchar',
  21. 'length' => 255,
  22. 'not null' => TRUE,
  23. 'default' => '',
  24. 'description' => 'The label of this Tripal Pane.',
  25. ),
  26. 'tripal_ds_field_name' => array(
  27. 'type' => 'varchar',
  28. 'length' => 255,
  29. 'not null' => TRUE,
  30. 'default' => '',
  31. 'description' => 'The name of this Tripal Pane.',
  32. ),
  33. 'bundle' => array(
  34. 'type' => 'varchar',
  35. 'length' => 128,
  36. 'not null' => TRUE,
  37. 'default' => ''
  38. ),
  39. 'weight' => array(
  40. 'type' => 'int',
  41. 'not null' => TRUE,
  42. 'default' => 1,
  43. ),
  44. ),
  45. 'primary key' => array('id'),
  46. );
  47. return $schema;
  48. }
  49. /**
  50. * Add a weight column to the tripal_ds table.
  51. */
  52. function tripal_ds_update_7300() {
  53. try {
  54. db_add_field('tripal_ds', 'weight', array(
  55. 'type' => 'int',
  56. 'not null' => TRUE,
  57. 'default' => 1,
  58. ));
  59. }
  60. catch (\PDOException $e) {
  61. $transaction->rollback();
  62. $error = $e->getMessage();
  63. throw new DrupalUpdateException('Could not perform update: '. $error);
  64. }
  65. }