You are here

function rate_schema in Rate 7.2

Same name and namespace in other branches
  1. 8.2 rate.install \rate_schema()
  2. 8 rate.install \rate_schema()
  3. 7 rate.install \rate_schema()

Implements hook_schema().

File

./rate.install, line 10
Main install tasks and update tasks for the Rate module.

Code

function rate_schema() {
  $schema = array();
  $schema['rate_widget'] = array(
    'fields' => array(
      'wid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'mode' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ),
      'sprites' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'highlight_voted' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'highlight_mouseover' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'desc_norating' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'desc_notvoted' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'desc_voted' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'desc_justvoted' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'desc_mouseover' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'css_file' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'js_file' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'wid',
    ),
  );
  $schema['rate_widget_button'] = array(
    'fields' => array(
      'wid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'num' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'label' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'value' => array(
        'type' => 'int',
        'unsigned' => FALSE,
        'not null' => TRUE,
      ),
      'description' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'width' => array(
        'type' => 'int',
        'unsigned' => TRUE,
      ),
      'height' => array(
        'type' => 'int',
        'unsigned' => TRUE,
      ),
      'img_default' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'img_highlighted' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'img_default_voted' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'img_highlighted_voted' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'img_disabled' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'img_disabled_voted' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
    ),
    'primary key' => array(
      'wid',
      'num',
    ),
  );
  $schema['rate_widget_element'] = array(
    'fields' => array(
      'wid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'prefix' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'suffix' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'weight' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      // 1 = full, 2 = compact, 4 = full disabled, 8 = compact disabled, 16 = closed
      'mode' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 31,
      ),
    ),
    'primary key' => array(
      'wid',
      'type',
    ),
  );
  $schema['rate_bot_agent'] = array(
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'pattern' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  $schema['rate_bot_ip'] = array(
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'ip' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  return $schema;
}