| 1 |
<?php
|
| 2 |
// $Id: book_manager.install 1100 2008-10-21 22:33:17Z jgraham $
|
| 3 |
// @file
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function book_manager_install() {
|
| 8 |
// Create tables.
|
| 9 |
drupal_install_schema('book_manager');
|
| 10 |
db_query("UPDATE {system} SET weight = 10 WHERE name = 'book_manager'"); // our module should run after the book module to ensure proper access control
|
| 11 |
}
|
| 12 |
|
| 13 |
/**
|
| 14 |
* Implementation of hook_uninstall().
|
| 15 |
*/
|
| 16 |
function book_manager_uninstall() {
|
| 17 |
// Remove tables.
|
| 18 |
drupal_uninstall_schema('book_manager');
|
| 19 |
}
|
| 20 |
|
| 21 |
/**
|
| 22 |
* Implementation of hook_schema().
|
| 23 |
*
|
| 24 |
* An entry in the {book_manager} table indicates that a
|
| 25 |
* book is to be considered personal, meaning that only the
|
| 26 |
* owner may add pages to it.
|
| 27 |
*/
|
| 28 |
function book_manager_schema() {
|
| 29 |
$schema['book_manager'] = array(
|
| 30 |
'description' => t('Connects a personal book with the user that owns it.'),
|
| 31 |
'fields' => array(
|
| 32 |
'bid' => array(
|
| 33 |
'type' => 'int',
|
| 34 |
'unsigned' => TRUE,
|
| 35 |
'not null' => TRUE,
|
| 36 |
'default' => 0,
|
| 37 |
'description' => t("The book ID is the {book}.nid of the top-level personal book page."),
|
| 38 |
),
|
| 39 |
),
|
| 40 |
'primary key' => array('bid'),
|
| 41 |
);
|
| 42 |
|
| 43 |
$schema['book_manager_history'] = array(
|
| 44 |
'description' => t('This table maintains source history for books derived via the copy feature'),
|
| 45 |
'fields' => array(
|
| 46 |
'bid' => array(
|
| 47 |
'type' => 'int',
|
| 48 |
'unsigned' => TRUE,
|
| 49 |
'not null' => TRUE,
|
| 50 |
'default' => 0,
|
| 51 |
'description' => t('The target book')),
|
| 52 |
'sbid' => array(
|
| 53 |
'type' => 'int',
|
| 54 |
'unsigned' => TRUE,
|
| 55 |
'not null' => TRUE,
|
| 56 |
'default' => 0,
|
| 57 |
'description' => t('The source book')),
|
| 58 |
'copied' => array(
|
| 59 |
'type' => 'int',
|
| 60 |
'unsigned' => TRUE,
|
| 61 |
'not null' => TRUE,
|
| 62 |
'default' => 0,
|
| 63 |
'description' => t('The datetime this was copied')),
|
| 64 |
),
|
| 65 |
'primary key' => array('bid'),
|
| 66 |
);
|
| 67 |
|
| 68 |
$schema['book_manager_node_history'] = array(
|
| 69 |
'description' => t('Maps source nids to copied nids.'),
|
| 70 |
'fields' => array(
|
| 71 |
'snid' => array(
|
| 72 |
'type' => 'int',
|
| 73 |
'unsigned' => TRUE,
|
| 74 |
'not null' => TRUE,
|
| 75 |
'default' => 0,
|
| 76 |
'description' => t('The source nid.'),
|
| 77 |
),
|
| 78 |
'tnid' => array(
|
| 79 |
'type' => 'int',
|
| 80 |
'unsigned' => TRUE,
|
| 81 |
'not null' => TRUE,
|
| 82 |
'default' => 0,
|
| 83 |
'description' => t('The target or copied (new) nid'),
|
| 84 |
),
|
| 85 |
),
|
| 86 |
'primary key' => array('tnid'),
|
| 87 |
);
|
| 88 |
|
| 89 |
return $schema;
|
| 90 |
}
|