| 1 |
<?php
|
| 2 |
// $Id: book_access.install,v 1.3 2007/11/29 21:52:00 hlslaughter Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function book_access_install() {
|
| 8 |
drupal_install_schema('book_access');
|
| 9 |
|
| 10 |
// not sure we need this
|
| 11 |
//db_query("UPDATE {system} SET weight = 2 WHERE name = 'book_access'");
|
| 12 |
|
| 13 |
drupal_set_message("Book access database tables created.");
|
| 14 |
}
|
| 15 |
|
| 16 |
/**
|
| 17 |
* Implementation of hook_schema().
|
| 18 |
*/
|
| 19 |
function book_access_schema() {
|
| 20 |
$schema['book_access'] = array(
|
| 21 |
'description' => t('Table for tracking book access.'),
|
| 22 |
'fields' => array(
|
| 23 |
'nid' => array(
|
| 24 |
'description' => t('Primary key: The node ID of the book.'),
|
| 25 |
'type' => 'int',
|
| 26 |
'not null' => TRUE,
|
| 27 |
'default' => 0,
|
| 28 |
),
|
| 29 |
'rid' => array(
|
| 30 |
'description' => t('Primary key: A role ID associated with a book node ID.'),
|
| 31 |
'type' => 'int',
|
| 32 |
'not null' => TRUE,
|
| 33 |
'default' => 0,
|
| 34 |
),
|
| 35 |
'grant_view' => array(
|
| 36 |
'description' => t('View book is allowed. 1 = TRUE, 0 = FALSE.'),
|
| 37 |
'type' => 'int',
|
| 38 |
'size' => 'tiny',
|
| 39 |
'insigned' => TRUE,
|
| 40 |
'not null' => TRUE,
|
| 41 |
'default' => 0,
|
| 42 |
),
|
| 43 |
'grant_update' => array(
|
| 44 |
'description' => t('Edit book pages is allowed. 1 = TRUE, 0 = FALSE.'),
|
| 45 |
'type' => 'int',
|
| 46 |
'size' => 'tiny',
|
| 47 |
'insigned' => TRUE,
|
| 48 |
'not null' => TRUE,
|
| 49 |
'default' => 0,
|
| 50 |
),
|
| 51 |
'grant_delete' => array(
|
| 52 |
'description' => t('Delete book pages is allowed. 1 = TRUE, 0 = FALSE.'),
|
| 53 |
'type' => 'int',
|
| 54 |
'size' => 'tiny',
|
| 55 |
'insigned' => TRUE,
|
| 56 |
'not null' => TRUE,
|
| 57 |
'default' => 0,
|
| 58 |
),
|
| 59 |
),
|
| 60 |
'primary key' => array('nid', 'rid'),
|
| 61 |
);
|
| 62 |
|
| 63 |
return $schema;
|
| 64 |
}
|
| 65 |
|
| 66 |
/**
|
| 67 |
* Implementation of hook_uninstall().
|
| 68 |
*/
|
| 69 |
function book_access_uninstall() {
|
| 70 |
drupal_uninstall_schema('book_access');
|
| 71 |
}
|