| 8 |
*/ |
*/ |
| 9 |
|
|
| 10 |
/** |
/** |
| 11 |
|
* Implementation of hook_schema(). |
| 12 |
|
*/ |
| 13 |
|
function category_views_schema() { |
| 14 |
|
$schema['category_views'] = array( |
| 15 |
|
'description' => 'Stores category_views settings for each container.', |
| 16 |
|
'fields' => array( |
| 17 |
|
'cid' => array( |
| 18 |
|
'type' => 'int', |
| 19 |
|
'unsigned' => true, |
| 20 |
|
'not null' => true, |
| 21 |
|
'default' => 0, |
| 22 |
|
'description' => 'ID of the container {category_cont}.cid', |
| 23 |
|
), |
| 24 |
|
'view_name' => array( |
| 25 |
|
'type' => 'varchar', |
| 26 |
|
'length' => '32', |
| 27 |
|
'default' => '0', |
| 28 |
|
'not null' => TRUE, |
| 29 |
|
'description' => 'The unique name of the View for this container.', |
| 30 |
|
), |
| 31 |
|
'display_cont' => array( |
| 32 |
|
'type' => 'int', |
| 33 |
|
'size' => 'tiny', |
| 34 |
|
'unsigned' => true, |
| 35 |
|
'not null' => true, |
| 36 |
|
'default' => 0, |
| 37 |
|
'description' => 'Whether the View should be used for this container itself', |
| 38 |
|
), |
| 39 |
|
'display_cat' => array( |
| 40 |
|
'type' => 'int', |
| 41 |
|
'size' => 'tiny', |
| 42 |
|
'unsigned' => true, |
| 43 |
|
'not null' => true, |
| 44 |
|
'default' => 0, |
| 45 |
|
'description' => 'Whether the View should be used for categories in this container', |
| 46 |
|
), |
| 47 |
|
), |
| 48 |
|
'primary key' => array('cid'), |
| 49 |
|
); |
| 50 |
|
return $schema; |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
/** |
| 54 |
* Implementation of hook_install(). |
* Implementation of hook_install(). |
| 55 |
*/ |
*/ |
| 56 |
function category_views_install() { |
function category_views_install() { |
| 58 |
} |
} |
| 59 |
|
|
| 60 |
/** |
/** |
| 61 |
|
* Implementation of hook_uninstall(). |
| 62 |
|
*/ |
| 63 |
|
function category_views_uninstall() { |
| 64 |
|
drupal_uninstall_schema('category_views'); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
/** |
| 68 |
* Install category_views table if it didn't already exist. |
* Install category_views table if it didn't already exist. |
| 69 |
*/ |
*/ |
| 70 |
function category_views_update_1() { |
function category_views_update_1() { |
| 82 |
} |
} |
| 83 |
return $ret; |
return $ret; |
| 84 |
} |
} |
| 85 |
|
|
| 86 |
|
/** |
| 87 |
|
* Update to 6.x: As of Views 2, Identifier of a view changed from numeric ID to |
| 88 |
|
* unique name (a string). There's no point in keeping old data in the column, as |
| 89 |
|
* all views must be re-created on 5.x to 6.x upgrade anyway. |
| 90 |
|
*/ |
| 91 |
|
function category_views_update_6000() { |
| 92 |
|
$ret = array(); |
| 93 |
|
|
| 94 |
|
$new_field = array( |
| 95 |
|
'type' => 'varchar', |
| 96 |
|
'length' => '32', |
| 97 |
|
'default' => '0', |
| 98 |
|
'not null' => TRUE, |
| 99 |
|
'description' => 'The unique name of the View for this container.', |
| 100 |
|
); |
| 101 |
|
|
| 102 |
|
db_drop_field($ret, 'category_views', 'view_id'); |
| 103 |
|
db_add_field($ret, 'category_views', 'view_name', $new_field); |
| 104 |
|
|
| 105 |
|
return $ret; |
| 106 |
|
} |