atrsimilar.install

<?php
// $Id: atrsimilar.install,v 1.1.2.1 2009/07/31 00:43:10 xano Exp $

/**
 * @file
 *   Installation and uninstallation functions.
 */

/**
 * Implementation of hook_schema().
 */
function atrsimilar_schema() {
  return array(
    'atrsimilar_string' => array(
      'description' => 'Strings that are similar to eachother..',
      'fields' => array(
        'sid_a' => array(
          'description' => 'The {atr_string}.sid of the first string.',
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
        ),
        'sid_b' => array(
          'description' => 'The {atr_string}.sid of the second string.',
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
        ),
        'similarity' => array(
          'description' => 'A percentage describing how similar sid_a and sid_b are.',
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
        ),
      ),
    ),
  );
}

/**
 * Implementation of hook_install().
 */
function atrsimilar_install() {
  drupal_install_schema('atrsimilar');
}

/**
 * Implementation of hook_uninstall().
 */
function atrsimilar_uninstall() {
  drupal_uninstall_schema('atrsimilar');

  db_query("DELETE FROM {variable} WHERE name LIKE 'atrsimilar_%%'");
  cache_clear_all('variables', 'cache');
}