You are here

oauth.install in OAuth 1.0 6

Same filename and directory in other branches
  1. 8.2 oauth.install
  2. 8 oauth.install

File

oauth.install
View source
<?php

function oauth_schema() {
  $schema['oauth_consumer'] = array(
    'description' => t('Stores records for OAuth consumers'),
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'consumer_key' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ),
      'consumer_secret' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'uid',
    ),
    'unique keys' => array(
      'uid' => array(
        'uid',
      ),
    ),
    'indexes' => array(
      'consumer_key' => array(
        'consumer_key',
      ),
    ),
  );
  $schema['oauth_nonce'] = array(
    'description' => t('Stores nonces for OAuth requests'),
    'fields' => array(
      'nonce' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'nonce_timestamp' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'nonce',
    ),
    'indexes' => array(
      'nonce_timestamp' => array(
        'nonce_timestamp',
      ),
    ),
  );
  $schema['oauth_token'] = array(
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'consumer_key' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 7,
        'not null' => TRUE,
      ),
      'token_key' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ),
      'token_secret' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ),
      'authorized' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'token_key',
    ),
    'unique keys' => array(
      'token_key' => array(
        'token_key',
      ),
    ),
    'indexes' => array(
      'oauth_token_key_type' => array(
        'token_key',
        'type',
      ),
    ),
  );
  $schema['oauth_services'] = array(
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'consumer_key' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ),
      'services' => array(
        'type' => 'varchar',
        'length' => 10000,
        'not null' => TRUE,
      ),
      'timestamp' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
      'session_id' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => FALSE,
      ),
      'token_key' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'indexes' => array(
      'timestamp' => array(
        'timestamp',
      ),
    ),
  );
  return $schema;
}
function oauth_install() {
  drupal_install_schema('oauth');
}
function oauth_uninstall() {
  drupal_uninstall_schema('oauth');
}