You are here

function services_update_6001 in Services 7

Same name and namespace in other branches
  1. 6.3 services.install \services_update_6001()
  2. 6 services.install \services_update_6001()
  3. 6.2 services.install \services_update_6001()

Implements hook_update().

Create the nonce table

File

./services.install, line 48
@author Services Dev Team

Code

function services_update_6001() {
  $schema['services_timestamp_nonce'] = array(
    'description' => 'Stores timestamp against nonce for repeat attacks.',
    'fields' => array(
      'timestamp' => array(
        'description' => 'The timestamp used with the Nonce.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'nonce' => array(
        'description' => 'The random string used on the request.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'domain' => array(
        'description' => 'The domain that submitted the request.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'indexes' => array(
      'timestamp' => array(
        'timestamp',
      ),
    ),
    'primary key' => array(
      'nonce',
    ),
  );
  $update = array();
  db_create_table($update, 'services_timestamp_nonce', $schema['services_timestamp_nonce']);
  return $update;
}