<?php
// $Id$

/**
 * @file
 * Install, uninstall and update function for the flag queue module.
 */

/**
 * Implementation of hook_schema().
 */
function flag_queue_schema() {
  $schema['flag_queue'] = array(
    'description' => 'Base table for queues, storing global information for each queue.',
    'fields' => array(
      'fid' => array(
        'description' => 'The flag ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE      
      ),
      'fcid' => array(
        'description' => 'The fcid from {flag_content} table.',
        'type' => 'int',
        'size' => 'small',
        'not null' => FALSE,
      ),
      // store the content ID because on unflag, we'll need to know get the
      // fcid from the content_id, but it's already deleted from {flag_content}. 
      'content_id' => array(
        'description' => 'The content ID.',
        'type' => 'int',
        'size' => 'small',
        'not null' => FALSE,
      ),      
      'position' => array(
        'description' => 'The position of the flagged content in this queue.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE
      ),          
    ),
    'primary key' => array('fcid'),
  ); 
    
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function flag_queue_install() {
  drupal_install_schema('flag_queue');
}

/**
 * Implementation of hook_uninstall().
 */
function flag_queue_uninstall() {
  drupal_uninstall_schema('flag_queue');
}
