You are here

rules_scheduler.install in Rules 6

Same filename and directory in other branches
  1. 7.2 rules_scheduler/rules_scheduler.install

Rules Scheduler - Installation file.

File

rules_scheduler/rules_scheduler.install
View source
<?php

/**
 * @file
 * Rules Scheduler - Installation file.
 */

/**
 * Implementation of hook_install().
 */
function rules_scheduler_install() {
  drupal_install_schema('rules_scheduler');
}

/**
 * Implementation of hook_uninstall().
 */
function rules_scheduler_uninstall() {
  drupal_uninstall_schema('rules_scheduler');
}

/**
 * Implementation of hook_schema().
 */
function rules_scheduler_schema() {
  $schema['rules_scheduler'] = array(
    'description' => t('Stores a schedule for rule sets.'),
    'fields' => array(
      'tid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => t("The scheduled task's id."),
      ),
      'set_name' => array(
        'type' => 'varchar',
        'length' => '255',
        'default' => '',
        'not null' => TRUE,
        'description' => t("The scheduled rule set's name."),
      ),
      'date' => array(
        'type' => 'datetime',
        'not null' => TRUE,
        'description' => t('When the task is to be scheduled.'),
      ),
      'arguments' => array(
        'type' => 'text',
        'not null' => FALSE,
        'serialize' => TRUE,
        'description' => t('The whole, serialized item configuration.'),
      ),
      'identifier' => array(
        'type' => 'varchar',
        'length' => '255',
        'default' => '',
        'not null' => FALSE,
        'description' => t('The user defined string identifying this task.'),
      ),
    ),
    'primary key' => array(
      'tid',
    ),
    'indexes' => array(
      'date' => array(
        'date',
      ),
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_update_N(). Adds an identifier field to the table.
 */
function rules_scheduler_update_6100() {
  $spec = array(
    'type' => 'varchar',
    'length' => '255',
    'default' => '',
    'not null' => FALSE,
    'description' => t('The user defined string identifying this task.'),
  );
  $ret = array();
  db_add_field($ret, 'rules_scheduler', 'identifier', $spec);
  drupal_set_message(t('Notice: concrete scheduling dates have to be specified in GMT now, so be aware to add out your local timezone!'));
  return $ret;
}

Functions

Namesort descending Description
rules_scheduler_install Implementation of hook_install().
rules_scheduler_schema Implementation of hook_schema().
rules_scheduler_uninstall Implementation of hook_uninstall().
rules_scheduler_update_6100 Implementation of hook_update_N(). Adds an identifier field to the table.