You are here

function domain_schema in Domain Access 7.3

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

Implements hook_schema().

File

./domain.install, line 18
Install file.

Code

function domain_schema() {
  $schema['domain'] = array(
    'description' => 'The base table for domain records',
    'fields' => array(
      'domain_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Domain numeric id.',
      ),
      'subdomain' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Registered DNS entry, will match HTTP_HOST requests',
      ),
      'sitename' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Site display name',
      ),
      'scheme' => array(
        'type' => 'varchar',
        'length' => '8',
        'not null' => TRUE,
        'default' => 'http',
        'description' => 'Protocol',
      ),
      'valid' => array(
        'type' => 'varchar',
        'length' => '1',
        'not null' => TRUE,
        'default' => '1',
        'description' => 'Active status',
      ),
      'weight' => array(
        'type' => 'int',
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Sort order',
      ),
      'is_default' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Indicates primary domain',
      ),
      'machine_name' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'The machine name for this domain.',
      ),
    ),
    'primary key' => array(
      'domain_id',
    ),
    'indexes' => array(
      'subdomain' => array(
        'subdomain',
      ),
      'weight' => array(
        'weight',
      ),
      'is_default' => array(
        'is_default',
      ),
    ),
    'foreign_keys' => array(
      'domain_id' => array(
        'domain_export' => 'domain_id',
      ),
      'machine_name' => array(
        'domain_export' => 'machine_name',
      ),
    ),
  );
  $schema['domain_access'] = array(
    'description' => 'Stores domain information for each node',
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Node id, foreign key to {node}',
      ),
      'gid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Node access grant id',
      ),
      'realm' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Node access realm',
      ),
    ),
    '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,
        'description' => 'User id, foreign key to {user}',
      ),
      'domain_id' => array(
        'type' => 'int',
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Domain id, foreign key to {domain}',
      ),
    ),
    'primary key' => array(
      'uid',
      'domain_id',
    ),
    'foreign_keys' => array(
      'uid' => array(
        'user' => 'uid',
      ),
      'domain_id' => array(
        'domain' => 'domain_id',
      ),
    ),
  );
  $schema['domain_export'] = array(
    'description' => 'Stores canonical machine names for domains.',
    'fields' => array(
      'domain_id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Domain id. Automatic master key.',
      ),
      'machine_name' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'The machine name for this domain.',
      ),
    ),
    'unique keys' => array(
      'machine_name' => array(
        'machine_name',
      ),
    ),
    'indexes' => array(
      'domain_id' => array(
        'domain_id',
      ),
    ),
  );
  return $schema;
}