You are here

function clients_schema in Web Service Clients 7

Same name and namespace in other branches
  1. 6.2 clients.install \clients_schema()
  2. 6 clients.install \clients_schema()
  3. 7.3 clients.install \clients_schema()
  4. 7.2 clients.install \clients_schema()

Implementation of hook_schema

File

./clients.install, line 33
Install, update and uninstall functions for the Clients module.

Code

function clients_schema() {
  $schema['cache_clients'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['clients_connections'] = array(
    'description' => 'Stores service connection configurations',
    'fields' => array(
      'cid' => array(
        'description' => 'The primary identifier for a service connection.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'Connection name, must be unique',
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
      ),
      'type' => array(
        'description' => 'Connection type',
        'type' => 'varchar',
        'length' => 100,
      ),
      'endpoint' => array(
        'description' => 'Connection endpoint',
        'type' => 'varchar',
        'length' => 100,
      ),
      'configuration' => array(
        'description' => 'Connection configuration - serialized',
        'serialize' => TRUE,
        'size' => 'big',
        'type' => 'text',
      ),
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
    'primary key' => array(
      'cid',
    ),
  );
  $schema['clients_resources'] = array(
    'description' => 'Stores service configurations - these are used as resources to clients',
    'fields' => array(
      'rid' => array(
        'description' => 'The primary identifier for a resource.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'Resource name, must be unique',
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
      ),
      'cid' => array(
        'description' => 'Foreign key referencing {clients_connections}',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'configuration' => array(
        'description' => 'Resource configuration - serialized',
        'serialize' => TRUE,
        'size' => 'big',
        'type' => 'text',
      ),
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
    'primary key' => array(
      'rid',
    ),
  );
  return $schema;
}