function tripal_contact_add_custom_tables

2.x tripal_contact.install tripal_contact_add_custom_tables()
1.x tripal_contact.install tripal_contact_add_custom_tables()

Add any custom tables needed by this module.

  • Contactprop: keep track of properties of contact

Related topics

1 call to tripal_contact_add_custom_tables()
tripal_contact_install in tripal_contact/tripal_contact.install
Implementation of hook_install().

File

tripal_contact/tripal_contact.install, line 175
Handles install, uninstall, disable and enable functionality including database tables.

Code

function tripal_contact_add_custom_tables() {
  $schema = array(
    'table' => 'contactprop',
    'fields' => array(
      'contactprop_id' => array(
        'type' => 'serial',
        'not null' => true,
      ),
      'contact_id' => array(
        'type' => 'int',
        'not null' => true,
      ),
      'type_id' => array(
        'type' => 'int',
        'not null' => true,
      ),
      'value' => array(
        'type' => 'text',
        'not null' => false,
      ),
      'rank' => array(
        'type' => 'int',
        'not null' => true,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      0 => 'contactprop_id',
    ),
    'unique keys' => array(
      'contactprop_c1' => array(
        0 => 'contact_id',
        1 => 'type_id',
        2 => 'rank',
      ),
    ),
    'indexes' => array(
      'contactprop_idx1' => array(
        0 => 'contact_id',
      ),
      'contactprop_idx2' => array(
        0 => 'type_id',
      ),
    ),
    'foreign keys' => array(
      'cvterm' => array(
        'table' => 'cvterm',
        'columns' => array(
          'type_id' => 'cvterm_id',
        ),
      ),
      'contact' => array(
        'table' => 'contact',
        'columns' => array(
          'contact_id' => 'contact_id',
        ),
      ),
    ),
  );
  chado_create_custom_table('contactprop', $schema, TRUE);
}