competition-8.x-1.x-dev/modules/competition_voting/competition_voting.install
modules/competition_voting/competition_voting.install
<?php
/**
* @file
* Contains competition_voting.install.
*/
use Drupal\competition_voting\CompetitionVoting;
/**
* Implements hook_schema().
*/
function competition_voting_schema() {
$schema[CompetitionVoting::VOTING_TABLE] = [
'description' => 'Store competition entry voting data.',
'fields' => [
'vid' => [
'description' => 'Vote ID',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'ceid' => [
'description' => 'Competition entry entity ID',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'source_id' => [
'description' => 'Source (supercookie or user) ID',
'type' => 'varchar',
'length' => 255,
'default' => NULL,
],
'source_ip' => [
'description' => 'Source IP address',
'type' => 'varchar',
'length' => 16,
'default' => NULL,
],
'round_id' => [
'description' => 'Judging round ID',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'timestamp' => [
'description' => 'Unix datetime',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
],
'primary key' => ['vid'],
'indexes' => [
'vote_ceid' => ['ceid'],
'vote_round_id' => ['round_id'],
],
];
return $schema;
}
