You are here

function openid_connect_schema in OpenID Connect / OAuth client 8

Implements hook_schema().

File

./openid_connect.install, line 11
Install, update and uninstall functions for the OpenID Connect module.

Code

function openid_connect_schema() {
  $schema['openid_connect_authmap'] = [
    'description' => 'Stores OpenID Connect authentication mapping.',
    'fields' => [
      'aid' => [
        'description' => 'Primary Key: Unique authmap ID.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'uid' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => "User's {users}.uid.",
      ],
      'client_name' => [
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The client name.',
      ],
      'sub' => [
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Unique subject identifier.',
      ],
    ],
    'primary key' => [
      'aid',
    ],
    'indexes' => [
      'uid' => [
        'uid',
      ],
      'identifier' => [
        'client_name',
        'sub',
      ],
    ],
    'foreign keys' => [
      'user' => [
        'table' => 'users',
        'columns' => [
          'uid' => 'uid',
        ],
      ],
    ],
  ];
  return $schema;
}