function tripal_example_add_exampleprop_table
2.x tripal_example.install | tripal_example_add_exampleprop_table() |
Adds the 'example_relationship' custom table to Chado.
1 call to tripal_example_add_exampleprop_table()
- tripal_example_add_custom_tables in tripal_example/
tripal_example.install - Add custom tables to Chado that are required by this module
File
- tripal_example/
tripal_example.install, line 363 - Installation of the example module
Code
function tripal_example_add_exampleprop_table() {
// EXPLANATION: use the Drupal Schema API to describe the custom table. Then
// add the table using the chado_create_custom_table() function.
// Add the exampleprop table
$schema = array(
'table' => 'exampleprop',
'fields' => array(
'exampleprop_id' => array(
'type' => 'serial',
'not null' => TRUE,
),
'example_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,
),
),
'primary key' => array(
0 => 'exampleprop_id',
),
'unique keys' => array(
'example_id_type_id_rank' => array(
0 => 'example_id',
1 => 'type_id',
2 => 'rank',
),
),
'foreign keys' => array(
'cvterm' => array(
'table' => 'cvterm',
'columns' => array(
'type_id' => 'cvterm_id',
),
),
'example' => array(
'table' => 'example',
'columns' => array(
'example_id' => 'example_id',
),
),
),
);
chado_create_custom_table('exampleprop', $schema, TRUE);
}