2006-07-13 13:14:25 +00:00
<?php
2009-05-13 19:42:18 +00:00
/**
* @file
* Install, update and uninstall functions for the book module.
*/
2006-09-01 07:40:08 +00:00
/**
2009-12-04 16:49:48 +00:00
* Implements hook_uninstall().
2006-09-01 07:40:08 +00:00
*/
function book_uninstall() {
2014-03-05 20:35:46 +00:00
// Clear book data out of the cache.
2014-03-26 13:19:28 +00:00
\Drupal::cache('data')->deleteAll();
2006-09-01 07:40:08 +00:00
}
2007-07-30 18:20:21 +00:00
2007-10-05 14:43:26 +00:00
/**
2009-12-04 16:49:48 +00:00
* Implements hook_schema().
2007-10-05 14:43:26 +00:00
*/
function book_schema() {
2017-03-04 01:20:24 +00:00
$schema['book'] = [
2014-03-05 20:35:46 +00:00
'description' => 'Stores book outline information. Uniquely defines the location of each node in the book outline',
2017-03-04 01:20:24 +00:00
'fields' => [
'nid' => [
2007-10-10 11:39:35 +00:00
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
2014-03-01 13:28:39 +00:00
'description' => "The book page's {node}.nid.",
2017-03-04 01:20:24 +00:00
],
'bid' => [
2007-10-10 11:39:35 +00:00
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
2014-03-01 13:28:39 +00:00
'description' => "The book ID is the {book}.nid of the top-level page.",
2017-03-04 01:20:24 +00:00
],
'pid' => [
2014-03-05 20:35:46 +00:00
'description' => 'The parent ID (pid) is the id of the node above in the hierarchy, or zero if the node is at the top level in its outline.',
2014-03-01 13:28:39 +00:00
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
2017-03-04 01:20:24 +00:00
],
'has_children' => [
2014-03-01 13:28:39 +00:00
'description' => 'Flag indicating whether any nodes have this node as a parent (1 = children exist, 0 = no children).',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'small',
2017-03-04 01:20:24 +00:00
],
'weight' => [
2014-03-01 13:28:39 +00:00
'description' => 'Weight among book entries in the same book at the same depth.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
2017-03-04 01:20:24 +00:00
],
'depth' => [
2014-03-01 13:28:39 +00:00
'description' => 'The depth relative to the top level. A link with pid == 0 will have depth == 1.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'small',
2017-03-04 01:20:24 +00:00
],
'p1' => [
2014-03-01 13:28:39 +00:00
'description' => 'The first nid in the materialized path. If N = depth, then pN must equal the nid. If depth > 1 then p(N-1) must equal the pid. All pX where X > depth must equal zero. The columns p1 .. p9 are also called the parents.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
2017-03-04 01:20:24 +00:00
],
'p2' => [
2014-03-01 13:28:39 +00:00
'description' => 'The second nid in the materialized path. See p1.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
2017-03-04 01:20:24 +00:00
],
'p3' => [
2014-03-01 13:28:39 +00:00
'description' => 'The third nid in the materialized path. See p1.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
2017-03-04 01:20:24 +00:00
],
'p4' => [
2014-03-01 13:28:39 +00:00
'description' => 'The fourth nid in the materialized path. See p1.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
2017-03-04 01:20:24 +00:00
],
'p5' => [
2014-03-01 13:28:39 +00:00
'description' => 'The fifth nid in the materialized path. See p1.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
2017-03-04 01:20:24 +00:00
],
'p6' => [
2014-03-01 13:28:39 +00:00
'description' => 'The sixth nid in the materialized path. See p1.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
2017-03-04 01:20:24 +00:00
],
'p7' => [
2014-03-01 13:28:39 +00:00
'description' => 'The seventh nid in the materialized path. See p1.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
2017-03-04 01:20:24 +00:00
],
'p8' => [
2014-03-01 13:28:39 +00:00
'description' => 'The eighth nid in the materialized path. See p1.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
2017-03-04 01:20:24 +00:00
],
'p9' => [
2014-03-01 13:28:39 +00:00
'description' => 'The ninth nid in the materialized path. See p1.',
2007-10-10 11:39:35 +00:00
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
2017-03-04 01:20:24 +00:00
],
],
'primary key' => ['nid'],
'indexes' => [
'book_parents' => ['bid', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9'],
],
];
2007-10-05 14:43:26 +00:00
return $schema;
}