You are here

function votingapi_update_7 in Voting API 6.2

Same name and namespace in other branches
  1. 5 votingapi.install \votingapi_update_7()
  2. 6 votingapi.install \votingapi_update_7()

File

./votingapi.install, line 187
Installation file for VotingAPI module.

Code

function votingapi_update_7() {

  // There are quite a few changes. Let's just take the easy way and nuke this puppy.
  // Nothing has been using the tables up to this point, anyhow.
  db_drop_table($ret, 'votingapi_action_set');
  db_drop_table($ret, 'votingapi_action_condition');
  db_drop_table($ret, 'votingapi_action');
  $name = 'votingapi_action_set';
  $table_votingapi_action_set = array(
    'fields' => array(
      'name' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'parent_name' => array(
        'type' => 'varchar',
        'default' => NULL,
      ),
      'content_type' => array(
        'type' => 'varchar',
        'length' => 20,
        'default' => NULL,
      ),
      'source' => array(
        'type' => 'varchar',
        'length' => 64,
        'default' => NULL,
      ),
      'description' => array(
        'type' => 'varchar',
        'length' => 255,
        'default' => NULL,
      ),
      'required' => array(
        'type' => 'int',
        'length' => 8,
        'not null' => TRUE,
        'default' => 0,
      ),
      'criteria_mask' => array(
        'type' => 'varchar',
        'length' => 8,
        'default' => 'AND',
      ),
      'weight' => array(
        'type' => 'int',
        'length' => 10,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary_key' => array(
      'name',
    ),
  );
  db_create_table($ret, $name, $table_votingapi_action_set);
  $name = 'votingapi_action_condition';
  $table_votingapi_action_condition = array(
    'fields' => array(
      'name' => array(
        'type' => 'varchar',
        'length' => 64,
        'length' => 64,
      ),
      'parent_name' => array(
        'type' => 'varchar',
        'default' => NULL,
      ),
      'description' => array(
        'type' => 'varchar',
        'length' => 255,
        'default' => NULL,
      ),
      'data' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'handler' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'name',
    ),
  );
  db_create_table($ret, $name, $table_votingapi_action_condition);
  $name = 'votingapi_action';
  $table_votingapi_action = array(
    'fields' => array(
      'parent_name' => array(
        'type' => 'varchar',
        'length' => 64,
        'length' => 64,
      ),
      'aid' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => 255,
      ),
    ),
  );
  db_create_table($ret, $name, $table_votingapi_action);
  return $ret;
}