| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 | <?php/** * @file * Install for a chado data entity - creates the base table for our entity. *//** * Implements hook_schema(). * * @ingroup entity_example */function tripal_entities_schema() {  $schema['chado_data'] = array(    'description' => 'The base table for Tripal Vocabulary-based entities.',    'fields' => array(      'entity_id' => array(        'description' => 'The primary identifier for a vocabulary entity.',        'type' => 'serial',        'unsigned' => TRUE,        'not null' => TRUE,      ),      'type' => array(        'description' => 'The type of entity. This should be an official term ID.',        'type' => 'varchar',        'length' => 64,        'not null' => TRUE,        'default' => '',      ),      'cvterm_id' => array(        'description' => 'The cvterm_id for the type of entity. This cvterm_id should match a record in the Chado cvterm table.',        'type' => 'varchar',        'length' => 32,        'not null' => TRUE,        'default' => '',      ),      'tablename' => array(        'description' => 'The Chado table that contains the record that this entity is associated with.',        'type' => 'varchar',        'length' => 128,        'not null' => TRUE,        'default' => ''      ),      'record_id' => array(        'description' => 'The unique numerical identifier for the record that this entity is associated with (e.g. feature_id, stock_id, library_id, etc.).',        'type' => 'int',        'not null' => TRUE,      ),      'title' => array(        'description' => 'The title of this node, always treated as non-markup plain text.',        'type' => 'text',        'not null' => TRUE,        'default' => '',      ),      'uid' => array(        'description' => 'The {users}.uid that owns this node; initially, this is the user that created it.',        'type' => 'int',        'not null' => TRUE,        'default' => 0,      ),      'status' => array(        'description' => 'Boolean indicating whether the node is published (visible to non-administrators).',        'type' => 'int',        'not null' => TRUE,        'default' => 1,      ),      'created' => array(        'description' => 'The Unix timestamp when the node was created.',        'type' => 'int',        'not null' => TRUE,        'default' => 0,      ),      'changed' => array(        'description' => 'The Unix timestamp when the node was most recently saved.',        'type' => 'int',        'not null' => TRUE,        'default' => 0,      ),    ),    'indexes' => array(      'entity_changed' => array('changed'),      'entity_created' => array('created'),      'tablename' => array('tablename'),      'record_id' => array('record_id'),      'chado_record' => array('tablename', 'record_id'),      'type' => array('type'),      'cvterm_id' => array('cvterm_id'),      'uid' => array('uid'),    ),    'unique keys' => array(      'record' => array('tablename', 'record_id'),    ),    'primary key' => array('entity_id'),  );  return $schema;}/** * Implements hook_uninstall(). * * At uninstall time we'll notify field.module that the entity was deleted * so that attached fields can be cleaned up. * * @ingroup entity_example */function tripal_entities_uninstall() {  // TODO: make this dynamic (not hardcoded bundle).  field_attach_delete_bundle('chado_data', 'gene');}
 |