<?php 

/**
 * @file (Un)installation and schema hooks for scheduled_actions module.
 */

/**
 * Implements hook_schema().
 */
function scheduled_actions_schema() {
  $schema['scheduled_actions'] = array(
    'description' => 'Table of scheduled actions.',
    'fields' => array(
      'said' => array(
        'description' => 'The primary identifier for a scheduled action.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE
      ),
      'aid' => array(
        'description' => 'Action to be triggered.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'time' => array(
        'description' => 'Scheduled time. Action will be triggered at that time.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'triggered_time' => array(
        'description' => 'Time when action was actually triggered.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'type' => array(
        'description' => 'Entity type of object.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'entity_id' => array(
        'description' => 'ID of entity to be loaded to object.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'context' => array(
        'description' => 'Context of action call.',
        'type' => 'blob',
      ),
    ), // fields
    'primary key' => array('said'),
  );
  
  return $schema;
}

/**
 * Implements hook_install().
 */
function scheduled_actions_install() {
  
}

/**
 * Implements hook_uninstall().
 */
function scheduled_actions_uninstall() {
  variable_del('scheduled_actions_needs_corrections');
  variable_del('scheduled_actions_archive_day_limit');
}