You are here

function domain_schema in Domain Access 7.2

Same name and namespace in other branches
  1. 6.2 domain.install \domain_schema()
  2. 7.3 domain.install \domain_schema()

Implements hook_schema()

File

./domain.install, line 46
Install file.

Code

function domain_schema() {
  $schema['domain'] = array(
    'description' => 'The base table for domain records',
    'fields' => array(
      'domain_id' => array(
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'subdomain' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
      'sitename' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
      'scheme' => array(
        'type' => 'varchar',
        'length' => '8',
        'not null' => TRUE,
        'default' => 'http',
      ),
      'valid' => array(
        'type' => 'varchar',
        'length' => '1',
        'not null' => TRUE,
        'default' => '1',
      ),
    ),
    'primary key' => array(
      'domain_id',
    ),
    'indexes' => array(
      'subdomain' => array(
        'subdomain',
      ),
    ),
  );
  $schema['domain_access'] = array(
    'description' => 'Stores domain information for each node',
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'gid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'realm' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'nid',
      'gid',
      'realm',
    ),
    'indexes' => array(
      'nid' => array(
        'nid',
      ),
    ),
    'foreign_keys' => array(
      'nid' => array(
        'node' => 'nid',
      ),
    ),
  );
  $schema['domain_editor'] = array(
    'description' => 'Stores domain information for each user',
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'domain_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'uid',
      'domain_id',
    ),
    'foreign_keys' => array(
      'uid' => array(
        'user' => 'uid',
      ),
      'domain_id' => array(
        'domain' => 'domain_id',
      ),
    ),
  );
  return $schema;
}