| 1 |
<?php
|
| 2 |
|
| 3 |
/**
|
| 4 |
* hook_install()
|
| 5 |
*/
|
| 6 |
function fb_feed_install() {
|
| 7 |
// Create tables.
|
| 8 |
drupal_install_schema('fb_feed');
|
| 9 |
}
|
| 10 |
|
| 11 |
/**
|
| 12 |
* hook_uninstall()
|
| 13 |
*/
|
| 14 |
function fb_feed_uninstall() {
|
| 15 |
// Remove tables.
|
| 16 |
drupal_uninstall_schema('fb_feed');
|
| 17 |
}
|
| 18 |
|
| 19 |
function fb_feed_schema() {
|
| 20 |
$schema['fb_feed_template'] = array(
|
| 21 |
'description' => 'Main FB_APP table',
|
| 22 |
'fields' => array(
|
| 23 |
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, ),
|
| 24 |
'fb_app_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, ),
|
| 25 |
'label' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, ),
|
| 26 |
'apikey' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, ),
|
| 27 |
'bundle_id' => array('type' => 'int', 'size' => 'big', 'unsigned' => TRUE, 'not null' => TRUE, ),
|
| 28 |
'fb_feed_data' => array('type' => 'text', 'size' => 'big', ),
|
| 29 |
),
|
| 30 |
'unique keys' => array(
|
| 31 |
'apikey' => array('label'),
|
| 32 |
),
|
| 33 |
'primary key' => array('nid'),
|
| 34 |
);
|
| 35 |
|
| 36 |
return $schema;
|
| 37 |
}
|
| 38 |
|
| 39 |
/**
|
| 40 |
* Add a label column.
|
| 41 |
*/
|
| 42 |
function fb_feed_update_6000() {
|
| 43 |
$ret = array();
|
| 44 |
db_add_column($ret, 'fb_feed_template', 'label', 'varchar(128)');
|
| 45 |
// TODO: populate label column, perhaps with nid.
|
| 46 |
db_add_unique_key($ret, 'fb_feed_template', 'label', array('label'));
|
| 47 |
return $ret;
|
| 48 |
}
|
| 49 |
?>
|