[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/data/data_node/ -> data_node.install (source)

   1  <?php
   2  /**
   3   * @file
   4   * Install hooks for Data Node module.
   5   */
   6  
   7  /**
   8   * Implementation of hook_schema().
   9   */
  10  function data_node_schema() {
  11    $schema = array();
  12    $schema['data_table_node'] = array(
  13      'description' => 'Relate data records to nodes',
  14      'fields' => array(
  15        'nid' => array(
  16          'type' => 'int',
  17          'size' => 'normal',
  18          'unsigned' => TRUE,
  19          'not null' => TRUE,
  20        ),
  21        'data_table_name' => array(
  22          'type' => 'varchar',
  23          'size' => 'normal',
  24          'length' => 64,
  25          'not null' => TRUE,
  26        ),
  27        'id' => array(
  28          'type' => 'int',
  29          'size' => 'normal',
  30          'unsigned' => TRUE,
  31          'not null' => TRUE,
  32        ),
  33      ),
  34      'indexes' => array(
  35        'nid' => array('nid'),
  36        'data_table_name' => array('data_table_name'),
  37        'id' => array('id'),
  38        'name_id' => array('data_table_name', 'id'),
  39      ),
  40      'primary key' => array('nid', 'data_table_name', 'id'),
  41    );
  42    return $schema;
  43  }
  44  
  45  /**
  46   * Implementation of hook_install().
  47   */
  48  function data_node_install() {
  49    drupal_install_schema('data_node');
  50  }
  51  
  52  /**
  53   * Implementation of hook_uninstall().
  54   */
  55  function data_node_uninstall() {
  56    drupal_uninstall_schema('data_node');
  57  }
  58  
  59  /**
  60   * Add an index to id and name.
  61   */
  62  function data_node_update_6001() {
  63    $ret = array();
  64    db_add_index($ret, 'data_table_node', 'name_id', array('data_table_name', 'id'));
  65    return $ret;
  66  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7