| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 | 
							- <?php
 
- // $Id$
 
- /**
 
-  * Install the tripal stock module including it's content type
 
-  * @file
 
-  */
 
- /** Implementation of hook_install() */
 
- function tripal_stock_install() {
 
- 	drupal_install_schema('tripal_stock');
 
- }
 
- /** Implementation of hook_uninstall() */
 
- function tripal_stock_uninstall() {
 
- 	drupal_uninstall_schema('tripal_stock');
 
- 	// Get the list of nodes to remove
 
- 	$sql_lib_id = "SELECT nid, vid ".
 
-                  "FROM {node} ".
 
-                  "WHERE type='chado_stock'";
 
- 	$result = db_query($sql_lib_id);
 
- 	//delete all nodes
 
- 	while ($node = db_fetch_object($result)) {
 
- 	node_delete($node->nid);
 
- 	}
 
- }
 
- /** Implementation of hook_schema() */
 
- function tripal_stock_schema() {
 
- 	$schema['chado_stock'] = array(
 
- 		'fields' => array(
 
-       'vid' => array(
 
- 				'type' => 'int',
 
- 				'unsigned' => TRUE,
 
- 				'not null' => TRUE,
 
-  	 	  ),
 
-   	  'nid' => array(
 
-    	   	'type' => 'int',
 
-    	   	'unsigned' => TRUE,
 
-    	   	'not null' => TRUE,
 
-   	  ),
 
-    	 	'stock_id' => array(
 
-    	   	'type' => 'int',
 
-    	   	'unsigned' => TRUE,
 
-    	   	'not null' => TRUE,
 
-     	),
 
-   	),
 
-   	'indexes' => array(
 
-     	'stock_id' => array('stock_id'),
 
-      	'nid' => array('nid'),
 
-   	),
 
-   	'unique' => array(
 
-     	'stock_id' => array('stock_id'),
 
-   	),
 
-   	'primary key' => array('vid'),
 
- 	);
 
-   return $schema;
 
- }
 
 
  |