Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / schema.twig
1 /**
2  * Implements hook_schema().
3  */
4 function {{ machine_name }}_schema() {
5   $schema['node'] = array(
6     // Example (partial) specification for table "node".
7     'description' => 'The base table for nodes.',
8     'fields' => array(
9       'nid' => array(
10         'description' => 'The primary identifier for a node.',
11         'type' => 'serial',
12         'unsigned' => TRUE,
13         'not null' => TRUE,
14       ),
15       'vid' => array(
16         'description' => 'The current {node_revision}.vid version identifier.',
17         'type' => 'int',
18         'unsigned' => TRUE,
19         'not null' => TRUE,
20         'default' => 0,
21       ),
22       'type' => array(
23         'description' => 'The {node_type} of this node.',
24         'type' => 'varchar',
25         'length' => 32,
26         'not null' => TRUE,
27         'default' => '',
28       ),
29       'title' => array(
30         'description' => 'The title of this node, always treated as non-markup plain text.',
31         'type' => 'varchar',
32         'length' => 255,
33         'not null' => TRUE,
34         'default' => '',
35       ),
36     ),
37     'indexes' => array(
38       'node_changed'        => array('changed'),
39       'node_created'        => array('created'),
40     ),
41     'unique keys' => array(
42       'nid_vid' => array('nid', 'vid'),
43       'vid'     => array('vid'),
44     ),
45     // For documentation purposes only; foreign keys are not created in the
46     // database.
47     'foreign keys' => array(
48       'node_revision' => array(
49         'table' => 'node_revision',
50         'columns' => array('vid' => 'vid'),
51       ),
52       'node_author' => array(
53         'table' => 'users',
54         'columns' => array('uid' => 'uid'),
55       ),
56     ),
57     'primary key' => array('nid'),
58   );
59   return $schema;
60 }