Mercurial > hg > isophonics-drupal-site
diff core/modules/book/book.install @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/modules/book/book.install Wed Nov 29 16:09:58 2017 +0000 @@ -0,0 +1,135 @@ +<?php + +/** + * @file + * Install, update and uninstall functions for the book module. + */ + +/** + * Implements hook_uninstall(). + */ +function book_uninstall() { + // Clear book data out of the cache. + \Drupal::cache('data')->deleteAll(); +} + +/** + * Implements hook_schema(). + */ +function book_schema() { + $schema['book'] = [ + 'description' => 'Stores book outline information. Uniquely defines the location of each node in the book outline', + 'fields' => [ + 'nid' => [ + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => "The book page's {node}.nid.", + ], + 'bid' => [ + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => "The book ID is the {book}.nid of the top-level page.", + ], + 'pid' => [ + '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.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ], + 'has_children' => [ + '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', + ], + 'weight' => [ + 'description' => 'Weight among book entries in the same book at the same depth.', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ], + 'depth' => [ + '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', + ], + 'p1' => [ + '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, + ], + 'p2' => [ + 'description' => 'The second nid in the materialized path. See p1.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ], + 'p3' => [ + 'description' => 'The third nid in the materialized path. See p1.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ], + 'p4' => [ + 'description' => 'The fourth nid in the materialized path. See p1.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ], + 'p5' => [ + 'description' => 'The fifth nid in the materialized path. See p1.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ], + 'p6' => [ + 'description' => 'The sixth nid in the materialized path. See p1.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ], + 'p7' => [ + 'description' => 'The seventh nid in the materialized path. See p1.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ], + 'p8' => [ + 'description' => 'The eighth nid in the materialized path. See p1.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ], + 'p9' => [ + 'description' => 'The ninth nid in the materialized path. See p1.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ], + ], + 'primary key' => ['nid'], + 'indexes' => [ + 'book_parents' => ['bid', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9'], + ], + ]; + + return $schema; +}