function node_schema
Same name and namespace in other branches
- 11.x core/modules/node/node.install \node_schema()
- 10 core/modules/node/node.install \node_schema()
- 9 core/modules/node/node.install \node_schema()
- 8.9.x core/modules/node/node.install \node_schema()
- 7.x modules/node/node.install \node_schema()
Implements hook_schema().
File
-
core/
modules/ node/ node.install, line 24
Code
function node_schema() : Schema {
$tables[] = new Table(name: 'node_access', description: 'Identifies which realm/grant pairs a user must possess in order to view, update, or delete specific nodes.', columns: [
Column::int(name: 'nid', description: 'The {node}.nid this record affects.', unsigned: TRUE, notNull: TRUE, default: new IntValue(0)),
Column::varcharAscii(name: 'langcode', description: 'The {language}.langcode of this node.', length: 12, notNull: TRUE, default: new StringValue('')),
Column::int(name: 'fallback', description: 'Boolean indicating whether this record should be used as a fallback if a language condition is not provided.', size: ColumnSize::Tiny, unsigned: TRUE, notNull: TRUE, default: new IntValue(1)),
Column::int(name: 'gid', description: "The grant ID a user must possess in the specified realm to gain this row's privileges on the node.", unsigned: TRUE, notNull: TRUE, default: new IntValue(0)),
Column::varcharAscii(name: 'realm', description: 'The realm in which the user must possess the grant ID. Modules can define one or more realms by implementing hook_node_grants().', length: 255, notNull: TRUE, default: new StringValue('')),
Column::int(name: 'grant_view', description: 'Boolean indicating whether a user with the realm/grant pair can view this node.', size: ColumnSize::Tiny, unsigned: TRUE, notNull: TRUE, default: new IntValue(0)),
Column::int(name: 'grant_update', description: 'Boolean indicating whether a user with the realm/grant pair can edit this node.', size: ColumnSize::Tiny, unsigned: TRUE, notNull: TRUE, default: new IntValue(0)),
Column::int(name: 'grant_delete', description: 'Boolean indicating whether a user with the realm/grant pair can delete this node.', size: ColumnSize::Tiny, unsigned: TRUE, notNull: TRUE, default: new IntValue(0)),
], primaryKey: new PrimaryKey([
'nid',
'gid',
'realm',
'langcode',
]), foreignKeys: [
new ForeignKey(name: 'affected_node', foreignTable: 'node', columns: [
'nid',
], foreignColumns: [
'nid',
]),
]);
return new Schema(type: SchemaDefinitionType::Module, name: 'node', tables: $tables);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.