|
@@ -52,6 +52,27 @@ function tripal_views_get_schemas (){
|
|
|
return $schema;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ *
|
|
|
+ */
|
|
|
+function tripal_views_update_6040 () {
|
|
|
+ $ret = array();
|
|
|
+
|
|
|
+ // Add Priority to tripal_views
|
|
|
+ db_add_field($ret, 'tripal_views', 'priority', array('type' => 'int'));
|
|
|
+ db_add_unique_key($ret,'tripal_views', 'priority', array('table_name','priority'));
|
|
|
+ db_add_index($ret,'tripal_views', 'priority', array('table_name','priority'));
|
|
|
+
|
|
|
+ // Add handler to tripal_views_join
|
|
|
+ db_add_field($ret, 'tripal_views_join', 'handler', array('type' => 'varchar','length' => '255','not null' => TRUE,'default' => ''));
|
|
|
+
|
|
|
+ // Add tripal_views_field to keep track of fields for views integration
|
|
|
+ $schema = tripal_views_views_schema();
|
|
|
+ db_create_table(&$ret, 'tripal_views_field', $schema['tripal_views_field']);
|
|
|
+
|
|
|
+ return $ret;
|
|
|
+}
|
|
|
+
|
|
|
/************************************************************************
|
|
|
*
|
|
|
*
|
|
@@ -80,6 +101,10 @@ function tripal_views_views_schema(){
|
|
|
'not null' => TRUE,
|
|
|
'default' => '',
|
|
|
),
|
|
|
+ 'priority' => array(
|
|
|
+ 'description' => 'when there are 2+ entries for the same table, the entry with the lightest (drupal-style) priority is used.',
|
|
|
+ 'type' => 'int',
|
|
|
+ ),
|
|
|
'name' => array(
|
|
|
'description' => 'Human readable name of this setup',
|
|
|
'type' => 'varchar',
|
|
@@ -97,10 +122,51 @@ function tripal_views_views_schema(){
|
|
|
),
|
|
|
'unique_keys' => array(
|
|
|
'setup_id' => array('setup_id'),
|
|
|
+ 'priority' => array('table_name','priority'),
|
|
|
+ ),
|
|
|
+ 'indexes' => array(
|
|
|
+ 'priority' => array('table_name','priority'),
|
|
|
),
|
|
|
'primary key' => array('setup_id'),
|
|
|
);
|
|
|
|
|
|
+ $schema['tripal_views_field'] = array(
|
|
|
+ 'description' => 'keep track of fields available for a given table',
|
|
|
+ 'fields' => array(
|
|
|
+ 'setup_id' => array(
|
|
|
+ 'description' => 'the id of the setup',
|
|
|
+ 'type' => 'int',
|
|
|
+ 'unsigned' => TRUE,
|
|
|
+ 'not null' => TRUE,
|
|
|
+ ),
|
|
|
+ 'column_name' => array(
|
|
|
+ 'description' => 'the name of the field in the database',
|
|
|
+ 'type' => 'varchar',
|
|
|
+ 'length' => '255',
|
|
|
+ 'not null' => TRUE,
|
|
|
+ ),
|
|
|
+ 'name' => array(
|
|
|
+ 'description' => 'the human-readable name of the field',
|
|
|
+ 'type' => 'varchar',
|
|
|
+ 'length' => '255',
|
|
|
+ 'not null' => TRUE,
|
|
|
+ ),
|
|
|
+ 'description' => array(
|
|
|
+ 'description' => 'A short description of the field -seen under the field in the views UI',
|
|
|
+ 'type' => 'varchar',
|
|
|
+ 'length' => '255',
|
|
|
+ 'not null' => TRUE,
|
|
|
+ ),
|
|
|
+ 'type' => array(
|
|
|
+ 'description' => 'the database type of this field (ie: int, varchar)',
|
|
|
+ 'type' => 'varchar',
|
|
|
+ 'length' => '50',
|
|
|
+ 'not null' => TRUE,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ 'primary key' => array('setup_id','column_name')
|
|
|
+ );
|
|
|
+
|
|
|
$schema['tripal_views_join'] = array(
|
|
|
'description' => 'coordinate the joining of tables',
|
|
|
'fields' => array(
|
|
@@ -143,6 +209,13 @@ function tripal_views_views_schema(){
|
|
|
'length' => '255',
|
|
|
'not null' => TRUE,
|
|
|
'default' => '',
|
|
|
+ ),
|
|
|
+ 'handler' => array(
|
|
|
+ 'description' => 'the name of the handler',
|
|
|
+ 'type' => 'varchar',
|
|
|
+ 'length' => '255',
|
|
|
+ 'not null' => TRUE,
|
|
|
+ 'default' => '',
|
|
|
),
|
|
|
),
|
|
|
'unique_keys' => array(
|