<?php
// $Id: simpleblogroll.install,v 1.1 2008/08/22 11:29:48 filiptc Exp $
/**
 * Installs the SimpleBlogroll module 
 * type.
 * @file
 */

/**
 * Implementation of hook_install().
 */
function simpleblogroll_install() {
  drupal_set_message('SimpleBlogroll installed.');
  drupal_set_message('Created \'simpleblogroll\' table in database.');
  drupal_install_schema('simpleblogroll');
}

/**
 * Implementation of hook_uninstall().
 */
function simpleblogroll_uninstall() {
  drupal_uninstall_schema('simpleblogroll');
  variable_del('simpleblogroll_feeds');
  variable_del('simpleblogroll_display');
  variable_del('simpleblogroll_cron_run');
  variable_del('simpleblogroll_cron_runs');
  variable_del('simpleblogroll_on_submit');
  variable_del('simpleblogroll_parse');
  variable_del('display_time_new');
  variable_del('display_links');
  variable_del('simpleblogroll_info');
  drupal_set_message('SimpleBlogroll uninstalled.');
  drupal_set_message('Deleted \'simpleblogroll\' table from database.');
  drupal_set_message('All module setting have been deleted.');
}

/**
 * advanced_help's initial schema.
 */
function simpleblogroll_schema() {
  $schema['simpleblogroll'] = array(
    'description' => t('Stores feed info and feed contents.'),
    'fields' => array(
      'feed_title' => array(
        'type' => 'varchar',
        'length' => '255',
        'default' => '',
        'not null' => TRUE,
        'description' => t('The fetched title.'),
      ),
      'feed_url' => array(
        'type' => 'varchar',
        'length' => '255',
        'default' => '',
        'not null' => TRUE,
        'description' => t('The feeds URL.'),
      ),
      'site_url' => array(
        'type' => 'varchar',
        'length' => '255',
        'default' => '',
        'not null' => TRUE,
        'description' => t('The URL of the feeds site.'),
      ),
      'last_item' => array(
        'type' => 'varchar',
        'length' => '255',
        'default' => '',
        'not null' => TRUE,
        'description' => t('The latest items title.'),
      ),
      'item_url' => array(
        'type' => 'varchar',
        'length' => '255',
        'default' => '',
        'not null' => TRUE,
        'description' => t('The latest items url.'),
      ),
      'timestamp' => array(
        'type' => 'int',
        'length' => '11',
        'default' => '0',
        'not null' => TRUE,
        'description' => t('The fetching timestamp.'),
      ),
    ),
    'indexes' => array('feed_url' => array('feed_url')),
  'primary key' => array('feed_title'),
  );

  return $schema;
}
