You are here

function simple_access_schema in Simple Access 8.3

Same name and namespace in other branches
  1. 6.2 simple_access.install \simple_access_schema()
  2. 7.2 simple_access.install \simple_access_schema()

Implements hook_schema().

File

./simple_access.install, line 20
Installation for Simple Access.

Code

function simple_access_schema() {
  $schema = [];
  $schema['simple_access_node_group'] = [
    'description' => 'Define all permissions for each node',
    'fields' => [
      'nid' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'gid' => [
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => 0,
      ],
      'grant_view' => [
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'grant_update' => [
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'grant_delete' => [
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'nid',
      'gid',
    ],
  ];
  $schema['simple_access_node_profile'] = [
    'fields' => [
      'nid' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'pid' => [
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'nid',
      'pid',
    ],
  ];
  return $schema;
}