function oauth_schema in OAuth 1.0 8
Same name and namespace in other branches
- 6 oauth.install \oauth_schema()
Implements hook_schema().
File
- ./
oauth.install, line 33 - Installation and schema related functions for the OAuth module.
Code
function oauth_schema() {
$schema = array();
$schema['oauth_consumer'] = array(
'description' => 'Keys and secrets for OAuth consumers, both those provided by this site and other sites.',
'fields' => array(
'cid' => array(
'type' => 'serial',
'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
'not null' => TRUE,
),
'uid' => array(
'description' => 'The application owner.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'key_hash' => array(
'description' => 'SHA1-hash of consumer_key.',
'type' => 'char',
'length' => 40,
'not null' => TRUE,
),
// Key is a reserved word in MySQL so let's avoid that
'consumer_key' => array(
'description' => 'Consumer key.',
'type' => 'text',
'not null' => TRUE,
),
'consumer_secret' => array(
'description' => 'Consumer secret.',
'type' => 'text',
'not null' => TRUE,
),
),
'primary key' => array(
'cid',
),
'indexes' => array(
'key_hash' => array(
'key_hash',
),
'uid' => array(
'uid',
),
),
'foreign keys' => array(
'users' => array(
'table' => 'users',
'columns' => array(
'uid' => 'uid',
),
),
),
);
return $schema;
}