| 1 |
<?php |
<?php |
| 2 |
// $Id: api.install,v 1.11.2.8 2009/08/30 01:11:36 drumm Exp $ |
// $Id: api.install,v 1.11.2.9 2009/10/08 06:07:45 drumm Exp $ |
| 3 |
|
|
| 4 |
function api_schema() { |
function api_schema() { |
| 5 |
$schema['api_branch'] = array( |
$schema['api_branch'] = array( |
| 6 |
'fields' => array( |
'fields' => array( |
| 7 |
'branch_name' => array('type' => 'varchar', 'length' => '31', 'not null' => TRUE, 'default' => ''), |
'branch_id' => array( |
| 8 |
|
'type' => 'serial', |
| 9 |
|
'unsigned' => TRUE, |
| 10 |
|
'not null' => TRUE, |
| 11 |
|
), |
| 12 |
|
'branch_name' => array( |
| 13 |
|
'type' => 'varchar', |
| 14 |
|
'length' => '31', |
| 15 |
|
'not null' => TRUE, |
| 16 |
|
'default' => '', |
| 17 |
|
), |
| 18 |
|
'project' => array( |
| 19 |
|
'type' => 'varchar', |
| 20 |
|
'length' => '31', |
| 21 |
|
'not null' => TRUE, |
| 22 |
|
'default' => '', |
| 23 |
|
), |
| 24 |
'title' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''), |
'title' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''), |
| 25 |
'directories' => array('type' => 'text', 'not null' => TRUE), |
'directories' => array('type' => 'text', 'not null' => TRUE), |
| 26 |
'excluded_directories' => array('type' => 'text', 'not null' => TRUE), |
'excluded_directories' => array('type' => 'text', 'not null' => TRUE), |
| 27 |
'weight' => array('type' => 'int', 'unsigned' => TRUE, 'size' => 'tiny', 'not null' => TRUE, 'default' => 0), |
'weight' => array('type' => 'int', 'unsigned' => TRUE, 'size' => 'tiny', 'not null' => TRUE, 'default' => 0), |
| 28 |
), |
), |
| 29 |
'primary key' => array('branch_name'), |
'primary key' => array('branch_id'), |
| 30 |
|
'unique keys' => array( |
| 31 |
|
'project_name' => array('project', 'branch_name'), |
| 32 |
|
), |
| 33 |
'indexes' => array( |
'indexes' => array( |
| 34 |
'weight' => array('weight'), |
'weight' => array('weight'), |
| 35 |
), |
), |
| 368 |
return $return; |
return $return; |
| 369 |
} |
} |
| 370 |
|
|
| 371 |
|
/** |
| 372 |
|
* Add project to branches. |
| 373 |
|
*/ |
| 374 |
|
function api_update_20() { |
| 375 |
|
$return = array(); |
| 376 |
|
|
| 377 |
|
db_drop_primary_key($return, 'api_branch'); |
| 378 |
|
db_add_field($return, 'api_branch', 'branch_id', array( |
| 379 |
|
'type' => 'serial', |
| 380 |
|
'unsigned' => TRUE, |
| 381 |
|
'not null' => TRUE, |
| 382 |
|
), array( |
| 383 |
|
'primary key' => array('branch_id'), |
| 384 |
|
)); |
| 385 |
|
db_add_field($return, 'api_branch', 'project', array( |
| 386 |
|
'type' => 'varchar', |
| 387 |
|
'length' => '31', |
| 388 |
|
'not null' => TRUE, |
| 389 |
|
'default' => '', |
| 390 |
|
), array( |
| 391 |
|
'unique keys' => array( |
| 392 |
|
'project_name' => array('project', 'branch_name'), |
| 393 |
|
), |
| 394 |
|
)); |
| 395 |
|
$return = update_sql("UPDATE {api_branch} SET project = 'drupal'"); |
| 396 |
|
variable_set('api_default_branch', db_result(db_query("SELECT branch_id FROM {api_branch} WHERE branch_name = '%s'", variable_get('api_default_branch', NULL)))); |
| 397 |
|
|
| 398 |
|
return $return; |
| 399 |
|
} |
| 400 |
|
|
| 401 |
function api_uninstall() { |
function api_uninstall() { |
| 402 |
drupal_uninstall_schema('api'); |
drupal_uninstall_schema('api'); |
| 403 |
variable_del('api_default_branch'); |
variable_del('api_default_branch'); |