You are here

plus1.install in Plus 1 6

Same filename and directory in other branches
  1. 6.2 plus1.install
  2. 7 plus1.install

File

plus1.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function plus1_install() {

  // Create tables.
  drupal_install_schema('plus1');
}

/**
 * Implementation of hook_schema().
 */
function plus1_schema() {
  $schema['plus1_vote'] = array(
    'description' => t('The table used by the Plus1 module.'),
    'fields' => array(
      'uid' => array(
        'description' => t('The primary identifier for the voter.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'nid' => array(
        'description' => t('The node that gets a vote.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'vote' => array(
        'description' => t('The vote.'),
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => FALSE,
        'not null' => FALSE,
      ),
      'created' => array(
        'description' => t('The timestamp of when the voter voted.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'uid',
      'nid',
    ),
    'indexes' => array(
      'score' => array(
        'vote',
      ),
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_uninstall().
 */
function plus1_uninstall() {

  // Remove tables.
  drupal_uninstall_schema('plus1');
}

Functions

Namesort descending Description
plus1_install Implementation of hook_install().
plus1_schema Implementation of hook_schema().
plus1_uninstall Implementation of hook_uninstall().