Skip to content

Instantly share code, notes, and snippets.

@pedrorocha-net
Created August 16, 2015 20:28

Revisions

  1. pedrorocha-net created this gist Aug 16, 2015.
    20 changes: 20 additions & 0 deletions hook_schema.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    $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'),
    ),
    );