You are here

function avatar_selection_schema in Avatar Selection 6

Same name and namespace in other branches
  1. 7 avatar_selection.install \avatar_selection_schema()

Implementation of hook_schema().

Generate the 'avatar_selection' sql table structure.

Return value

$schema The sql table structure.

File

./avatar_selection.install, line 16
The Avatar Selection module install file.

Code

function avatar_selection_schema() {
  $schema['avatar_selection'] = array(
    'description' => 'List of available avatars and their names.',
    'fields' => array(
      'aid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Avatar identifier.',
      ),
      'avatar' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'description' => 'Avatar image filename.',
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 255,
        'description' => 'Avatar name.',
      ),
      'weight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Avatar weight.',
      ),
    ),
    'primary key' => array(
      'aid',
    ),
    'unique keys' => array(
      'avatar' => array(
        'avatar',
      ),
    ),
  );
  $schema['avatar_selection_roles'] = array(
    'fields' => array(
      'aid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Avatar identifier.',
      ),
      'rid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Role identifier.',
      ),
    ),
  );
  $schema['avatar_selection_og'] = array(
    'fields' => array(
      'aid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Avatar identifier.',
      ),
      'ogid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Organic group identifier.',
      ),
    ),
  );
  return $schema;
}