| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 | 
							- <?php
 
- function tripal_views_integration_schema(){
 
- 	$schema = array();
 
- 	$schema['tripal_views_integration'] = array(
 
- 		'description' => 'contains the setupes, their materialized view id and base table name that was used.',
 
- 		'fields' => array(
 
- 			'setup_id' => array(
 
- 				'description' => 'the id of the setup',
 
- 				'type' => 'serial',
 
- 				'unsigned' => TRUE,
 
- 				'not null' => TRUE,
 
- 			),
 
- 			'mview_id' => array(
 
- 				'description' => 'the materialized view used for this setup',
 
- 				'type' => 'int',
 
- 				'unsigned' => TRUE,
 
- 			),
 
- 			'chado_table_name' => array(
 
- 				'description' => 'the base table name to be used when using this setup',
 
- 				'type' => 'varchar',
 
- 				'length' => 255,
 
- 				'not null' => TRUE,
 
- 				'default' => '',
 
- 			),
 
- 			'name' => array(
 
- 				'description' => 'Human readable name of this setup',
 
- 				'type' => 'varchar',
 
- 				'length' => 255,
 
- 				'not null' => TRUE,
 
- 				'default' => '',
 
- 			),
 
- 			'description' => array(
 
- 				'description' => 'description of this row',
 
- 				'type' => 'varchar',
 
- 				'length' => 255,
 
- 				'not null' => TRUE,
 
- 				'default' => '',
 
- 			),
 
- 		),
 
- 		'unique_keys' => array(
 
- 			'setup_id' => array('setup_id'),
 
- 		),
 
- 		'primary key' => array('setup_id'),
 
- 	);
 
- 	$schema['tripal_mviews_join'] = array(
 
- 		'description' => 'which materialzed views and chado tables to join in a given setup',
 
- 		'fields' => array(
 
- 		  'mview_join_id' => array(
 
- 				'description' => 'the id of the join',
 
- 					'type' => 'serial',
 
- 					'unsigned' => TRUE,
 
- 					'not null' => TRUE,
 
- 		  ),
 
- 			'setup_id' => array(
 
- 				'description' => 'tripal setup id from tripal_views_integration table',
 
- 				'type' => 'int',
 
- 				'unsigned' => TRUE,
 
- 				'not null'=> TRUE,
 
- 			),
 
- 			'view_table' => array(
 
- 					'description' => 'materialized view table name',
 
- 					'type' => 'varchar',
 
- 					'length' => '255',
 
- 					'not null' => TRUE,
 
- 					'default' => '',
 
- 	    ),
 
- 			'view_column' => array(
 
- 				'description' => 'column of materialized view table (mview_table)',
 
- 				'type' => 'varchar',
 
- 				'length' => '255',
 
- 				'not null' => TRUE,
 
- 				'default' => '',
 
- 			),
 
- 			'chado_table_join' => array(
 
- 				'description' => 'on which chado table to join to materialized view in this serach',
 
- 				'type' => 'varchar',
 
- 				'length' => '255',
 
- 				'not null' => TRUE,
 
- 				'default' => '',
 
- 			),
 
- 			'chado_column' => array(
 
- 				'description' => 'chado table (above) column to join on materialized view in this serach',
 
- 				'type' => 'varchar',
 
- 				'length' => '255',
 
- 				'not null' => TRUE,
 
- 				'default' => '',
 
- 	    ),
 
- 		),
 
- 		'unique_keys' => array(
 
- 			'setup_id' => array('mview_join_id'),
 
- 		),
 
- 		'primary key' => array('mview_join_id'),
 
- 	);
 
- 	$schema['tripal_views_handlers'] = array(
 
- 		'description' => 'in formation for views: column and views handler name',
 
- 		'fields' => array(
 
- 			'handler_id' => array(
 
- 				'description' => 'the id of the handler',
 
- 					'type' => 'serial',
 
- 					'unsigned' => TRUE,
 
- 					'not null' => TRUE,
 
- 	    ),
 
- 			'setup_id' => array(
 
- 				'description' => 'which setup this is used by from tripal_views_integration table',
 
- 					'type' => 'int',
 
- 					'unsigned' => TRUE,
 
- 					'not null'=> TRUE,
 
- 			),
 
- 			'column_name' => array(
 
- 				'description' => '',
 
- 				'type' => 'varchar',
 
- 				'length' => '255',
 
- 				'not null' => TRUE,
 
- 				'default' => '',
 
- 			),
 
- 			'handler_filter' => array(
 
- 				'description' => 'identifier of the handler filter to be used for this column',
 
- 				'type' => 'varchar',
 
- 				'length' => '255',
 
- 				'not null' => TRUE,
 
- 				'default' => '',
 
- 			),
 
- 			'handler_field' => array(
 
- 				'description' => 'identifier of the handler field to be used for this column',
 
- 				'type' => 'varchar',
 
- 				'length' => '255',
 
- 				'not null' => TRUE,
 
- 				'default' => '',
 
- 	    ),
 
- 		),
 
- 		'unique_keys' => array(
 
- 				'setup_id' => array('handler_id'),
 
- 	  ),
 
- 		'primary key' => array('handler_id'),
 
- 	);
 
- 	return $schema;
 
- }
 
- function tripal_views_integration_install(){
 
- 	drupal_install_schema('tripal_views_integration');
 
- }
 
- function tripal_views_integration_uninstall(){
 
- 	drupal_uninstall_schema('tripal_views_integration');
 
- }
 
- /*
 
-  * NOTE: when updating schema for this module's tables
 
-  * follow api of schema module, otherwise on uninstall
 
-  * the tables will not be removed correctly
 
-  *
 
-  */
 
 
  |