You are here

function ldap_api_schema in Lightweight Directory Access Protocol (LDAP) 6

Implementation of hook_schema().

File

./ldap_api.install, line 25
Install, update and uninstall functions for the LDAP API module.

Code

function ldap_api_schema() {
  $schema['ldap_servers'] = array(
    'description' => 'Table for generic server configuration.',
    'fields' => array(
      'sid' => array(
        'type' => 'serial',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'address' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'port' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 389,
      ),
      'tls' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'basedn' => array(
        'type' => 'text',
      ),
      'binddn' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'bindpw' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'active' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 1,
      ),
      'weight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'sid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  $schema['ldap_options'] = array(
    'description' => 'Table for LDAP module options.',
    'fields' => array(
      'oid' => array(
        'type' => 'serial',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'module' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'key' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'value' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'oid',
    ),
  );
  $schema['ldap_cache'] = array(
    'description' => 'Cache table for caching DN mappings and other LDAP specific things.',
    'fields' => array(
      'cid' => array(
        'description' => 'Primary Key: Unique cache ID.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'data' => array(
        'description' => 'A collection of data to cache.',
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
      ),
      'expire' => array(
        'description' => 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'created' => array(
        'description' => 'A Unix timestamp indicating when the cache entry was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'headers' => array(
        'description' => 'Any custom HTTP headers to be added to cached data.',
        'type' => 'text',
        'not null' => FALSE,
      ),
      'serialized' => array(
        'description' => 'A flag to indicate whether content is serialized (1) or not (0).',
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'expire' => array(
        'expire',
      ),
    ),
    'primary key' => array(
      'cid',
    ),
  );
  $schema['ldap_mapping'] = array(
    'description' => 'Table to provide (Drupal) field<->(LDAP) attribute mapping.',
    'fields' => array(
      'mid' => array(
        'type' => 'serial',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'field' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'attribute' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'module' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'mid',
    ),
  );
  return $schema;
}