function votingapi_schema in Voting API 7.2
Same name and namespace in other branches
- 6.2 votingapi.install \votingapi_schema()
- 7.3 votingapi.install \votingapi_schema()
Implements hook_schema().
File
- ./
votingapi.install, line 11 - Installation file for VotingAPI module.
Code
function votingapi_schema() {
$schema['votingapi_vote'] = array(
'fields' => array(
'vote_id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'entity_type' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => 'node',
),
'entity_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'value' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
),
'value_type' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => 'percent',
),
'tag' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => 'vote',
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'timestamp' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'vote_source' => array(
'type' => 'varchar',
'length' => 255,
),
),
'primary key' => array(
'vote_id',
),
'indexes' => array(
'content_uid' => array(
'entity_type',
'entity_id',
'uid',
),
'content_uid_2' => array(
'entity_type',
'uid',
),
'content_source' => array(
'entity_type',
'entity_id',
'vote_source',
),
'content_value_tag' => array(
'entity_type',
'entity_id',
'value_type',
'tag',
),
),
);
$schema['votingapi_cache'] = array(
'fields' => array(
'vote_cache_id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'entity_type' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => 'node',
),
'entity_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'value' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
),
'value_type' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => 'percent',
),
'tag' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => 'vote',
),
'function' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'timestamp' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'vote_cache_id',
),
'indexes' => array(
'content' => array(
'entity_type',
'entity_id',
),
'content_function' => array(
'entity_type',
'entity_id',
'function',
),
'content_tag_func' => array(
'entity_type',
'entity_id',
'tag',
'function',
),
'content_vtype_tag' => array(
'entity_type',
'entity_id',
'value_type',
'tag',
),
'content_vtype_tag_func' => array(
'entity_type',
'entity_id',
'value_type',
'tag',
'function',
),
),
);
return $schema;
}