You are here

function _oauth_common_token_schema in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 7.4 oauth_common.install \_oauth_common_token_schema()
  2. 7.3 oauth_common.install \_oauth_common_token_schema()

Contains the token schema - used by oauth_common_schema() as well as latest related update function

2 calls to _oauth_common_token_schema()
oauth_common_schema in ./oauth_common.install
Implementation of hook_schema().
_oauth_common_update_6300 in updates/update.6300.inc
This update massively refactors the database.

File

./oauth_common.install, line 246
Installation and schema related functions for the OAuth module

Code

function _oauth_common_token_schema() {
  return array(
    'description' => 'Tokens stored on behalf of providers or consumers for request and services accesses.',
    'fields' => array(
      'tid' => array(
        'type' => 'serial',
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        'not null' => TRUE,
      ),
      'csid' => array(
        'description' => 'The {oauth_common_consumer}.csid this token is related to.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'key_hash' => array(
        'description' => 'SHA1-hash of token_key.',
        'type' => 'char',
        'length' => 40,
        'not null' => TRUE,
      ),
      // Key is a reserved word in MySQL so lets avoid that
      'token_key' => array(
        'description' => 'Token key.',
        'type' => 'text',
        'not null' => TRUE,
      ),
      'secret' => array(
        'description' => 'Token secret.',
        'type' => 'text',
        'not null' => TRUE,
      ),
      'expires' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The expiry time for the token, as a Unix timestamp.',
      ),
      'type' => array(
        'description' => 'Token type: request or access.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 1,
      ),
      'uid' => array(
        'description' => 'User ID from {user}.uid.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'tid',
    ),
    'indexes' => array(
      'key_hash' => array(
        'key_hash',
      ),
    ),
  );
}