/[drupal]/contributions/modules/api/api.install
ViewVC logotype

Diff of /contributions/modules/api/api.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.11.2.10, Thu Oct 15 05:52:59 2009 UTC revision 1.11.2.11, Sun Oct 18 23:07:51 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: api.install,v 1.11.2.9 2009/10/08 06:07:45 drumm Exp $  // $Id: api.install,v 1.11.2.10 2009/10/15 05:52:59 drumm Exp $
3    
4  function api_schema() {  function api_schema() {
5    $schema['api_branch'] = array(    $schema['api_branch'] = array(
# Line 37  function api_schema() { Line 37  function api_schema() {
37    $schema['api_documentation'] = array(    $schema['api_documentation'] = array(
38      'fields' => array(      'fields' => array(
39        'did' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),        'did' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
40          'branch_id' => array(
41            'type' => 'serial',
42            'unsigned' => TRUE,
43            'not null' => TRUE,
44          ),
45        'object_name' => array('type' => 'varchar', 'length' => '127', 'not null' => TRUE, 'default' => ''),        'object_name' => array('type' => 'varchar', 'length' => '127', 'not null' => TRUE, 'default' => ''),
       'branch_name' => array('type' => 'varchar', 'length' => '31', 'not null' => TRUE, 'default' => ''),  
46        'object_type' => array('type' => 'varchar', 'length' => '31', 'not null' => TRUE, 'default' => ''),        'object_type' => array('type' => 'varchar', 'length' => '31', 'not null' => TRUE, 'default' => ''),
47        'title' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''),        'title' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''),
48        'file_name' => array('type' => 'varchar', 'length' => '127', 'not null' => TRUE, 'default' => ''),        'file_name' => array('type' => 'varchar', 'length' => '127', 'not null' => TRUE, 'default' => ''),
# Line 48  function api_schema() { Line 52  function api_schema() {
52        'start_line' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),        'start_line' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
53      ),      ),
54      'primary key' => array('did'),      'primary key' => array('did'),
     'unique keys' => array(  
       'object_name' => array('object_name', 'branch_name', 'object_type'),  
     ),  
55      'indexes' => array(      'indexes' => array(
56        'branch_name' => array('branch_name'),        'object_name' => array('object_name', 'branch_id', 'object_type'),
57          'branch_id' => array('branch_id'),
58        'title' => array('title'),        'title' => array('title'),
59      ),      ),
60    );    );
# Line 77  function api_schema() { Line 79  function api_schema() {
79    $schema['api_reference_storage'] = array(    $schema['api_reference_storage'] = array(
80      'fields' => array(      'fields' => array(
81        'object_name' => array('type' => 'varchar', 'length' => '127', 'not null' => TRUE, 'default' => ''),        'object_name' => array('type' => 'varchar', 'length' => '127', 'not null' => TRUE, 'default' => ''),
82        'branch_name' => array('type' => 'varchar', 'length' => '31', 'not null' => TRUE, 'default' => ''),        'branch_id' => array(
83            'type' => 'int',
84            'unsigned' => TRUE,
85            'not null' => TRUE,
86          ),
87        'object_type' => array('type' => 'varchar', 'length' => '31', 'not null' => TRUE, 'default' => ''),        'object_type' => array('type' => 'varchar', 'length' => '31', 'not null' => TRUE, 'default' => ''),
88        'from_did' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),        'from_did' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
89        'to_did' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),        'to_did' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
90      ),      ),
91      'indexes' => array(      'indexes' => array(
92        'object_ref' => array('object_name', 'branch_name', 'object_type'),        'object_ref' => array('object_name', 'branch_id', 'object_type'),
93        'to_did' => array('to_did'),        'to_did' => array('to_did'),
94      ),      ),
95    );    );
# Line 398  function api_update_20() { Line 404  function api_update_20() {
404    return $return;    return $return;
405  }  }
406    
407    function api_update_21() {
408      $return = array();
409    
410      db_add_field($return, 'api_reference_storage', 'branch_id', array(
411        'type' => 'int',
412        'unsigned' => TRUE,
413        'not null' => TRUE,
414      ));
415      $return[] = update_sql("UPDATE {api_reference_storage} r INNER JOIN {api_branch} b ON b.branch_name = r.branch_name SET r.branch_id = b.branch_id");
416      db_drop_index($return, 'api_reference_storage', 'object_ref');
417      db_add_index($return, 'api_reference_storage', 'object_ref', array('object_name', 'branch_id', 'object_type'));
418    
419      return $return;
420    }
421    
422    function api_update_22() {
423      $return = array();
424    
425      db_add_field($return, 'api_documentation', 'branch_id', array(
426        'type' => 'int',
427        'unsigned' => TRUE,
428        'not null' => TRUE,
429      ));
430      $return[] = update_sql("UPDATE {api_documentation} r INNER JOIN {api_branch} b ON b.branch_name = r.branch_name SET r.branch_id = b.branch_id");
431      db_drop_index($return, 'api_documentation', 'object_name');
432      db_add_index($return, 'api_documentation', 'object_name', array('object_name', 'branch_id', 'object_type'));
433      db_drop_index($return, 'api_documentation', 'branch_name');
434      db_add_index($return, 'api_documentation', 'branch_id', array('branch_id'));
435    
436      return $return;
437    }
438    
439  function api_uninstall() {  function api_uninstall() {
440    drupal_uninstall_schema('api');    drupal_uninstall_schema('api');
441    variable_del('api_default_branch');    variable_del('api_default_branch');

Legend:
Removed from v.1.11.2.10  
changed lines
  Added in v.1.11.2.11

  ViewVC Help
Powered by ViewVC 1.1.2