Mercurial > hg > cmmr2012-drupal-site
annotate vendor/chi-teck/drupal-code-generator/templates/d8/hook/schema.twig @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
rev | line source |
---|---|
Chris@0 | 1 /** |
Chris@0 | 2 * Implements hook_schema(). |
Chris@0 | 3 */ |
Chris@0 | 4 function {{ machine_name }}_schema() { |
Chris@0 | 5 $schema['node'] = [ |
Chris@0 | 6 // Example (partial) specification for table "node". |
Chris@0 | 7 'description' => 'The base table for nodes.', |
Chris@0 | 8 'fields' => [ |
Chris@0 | 9 'nid' => [ |
Chris@0 | 10 'description' => 'The primary identifier for a node.', |
Chris@0 | 11 'type' => 'serial', |
Chris@0 | 12 'unsigned' => TRUE, |
Chris@0 | 13 'not null' => TRUE, |
Chris@0 | 14 ], |
Chris@0 | 15 'vid' => [ |
Chris@0 | 16 'description' => 'The current {node_field_revision}.vid version identifier.', |
Chris@0 | 17 'type' => 'int', |
Chris@0 | 18 'unsigned' => TRUE, |
Chris@0 | 19 'not null' => TRUE, |
Chris@0 | 20 'default' => 0, |
Chris@0 | 21 ], |
Chris@0 | 22 'type' => [ |
Chris@0 | 23 'description' => 'The type of this node.', |
Chris@0 | 24 'type' => 'varchar', |
Chris@0 | 25 'length' => 32, |
Chris@0 | 26 'not null' => TRUE, |
Chris@0 | 27 'default' => '', |
Chris@0 | 28 ], |
Chris@0 | 29 'title' => [ |
Chris@0 | 30 'description' => 'The node title.', |
Chris@0 | 31 'type' => 'varchar', |
Chris@0 | 32 'length' => 255, |
Chris@0 | 33 'not null' => TRUE, |
Chris@0 | 34 'default' => '', |
Chris@0 | 35 ], |
Chris@0 | 36 ], |
Chris@0 | 37 'indexes' => [ |
Chris@0 | 38 'node_changed' => ['changed'], |
Chris@0 | 39 'node_created' => ['created'], |
Chris@0 | 40 ], |
Chris@0 | 41 'unique keys' => [ |
Chris@0 | 42 'nid_vid' => ['nid', 'vid'], |
Chris@0 | 43 'vid' => ['vid'], |
Chris@0 | 44 ], |
Chris@0 | 45 // For documentation purposes only; foreign keys are not created in the |
Chris@0 | 46 // database. |
Chris@0 | 47 'foreign keys' => [ |
Chris@0 | 48 'node_revision' => [ |
Chris@0 | 49 'table' => 'node_field_revision', |
Chris@0 | 50 'columns' => ['vid' => 'vid'], |
Chris@0 | 51 ], |
Chris@0 | 52 'node_author' => [ |
Chris@0 | 53 'table' => 'users', |
Chris@0 | 54 'columns' => ['uid' => 'uid'], |
Chris@0 | 55 ], |
Chris@0 | 56 ], |
Chris@0 | 57 'primary key' => ['nid'], |
Chris@0 | 58 ]; |
Chris@0 | 59 return $schema; |
Chris@0 | 60 } |