You are here

function ultimate_cron_schema in Ultimate Cron 7.2

Same name and namespace in other branches
  1. 8.2 ultimate_cron.install \ultimate_cron_schema()
  2. 8 ultimate_cron.install \ultimate_cron_schema()
  3. 6 ultimate_cron.install \ultimate_cron_schema()
  4. 7 ultimate_cron.install \ultimate_cron_schema()

Implements hook_schema().

File

./ultimate_cron.install, line 10
Installation file for Ultimate Cron.

Code

function ultimate_cron_schema() {
  $schema = array();
  $class = variable_get('ultimate_cron_class_job', 'UltimateCronJob');
  $schema['ultimate_cron_job'] = array(
    'description' => 'Cron jobs',
    'export' => array(
      'admin_title' => 'title',
      'key' => 'name',
      'primary key' => 'jid',
      'identifier' => 'job',
      'load callback' => '_ultimate_cron_job_load',
      'load all callback' => '_ultimate_cron_job_load_all',
      'load multiple callback' => '_ultimate_cron_job_load_multiple',
      'save callback' => '_ultimate_cron_job_save',
      'delete callback' => '_ultimate_cron_job_delete',
      'status callback' => '_ultimate_cron_job_set_status',
      'import callback' => '_ultimate_cron_job_import',
      'export callback' => '_ultimate_cron_job_export',
      'cache defaults' => TRUE,
      'default cache bin' => 'cache_ultimate_cron',
      'object' => $class,
      'api' => array(
        'owner' => 'ultimate_cron',
        'api' => 'ultimate_cron',
        'minimum_version' => 3,
        'current_version' => 3,
      ),
    ),
    'fields' => array(
      'jid' => array(
        'description' => 'Job ID',
        'type' => 'serial',
        'size' => 'normal',
        'not null' => TRUE,
        'no export' => TRUE,
      ),
      'name' => array(
        'description' => 'Name',
        'type' => 'varchar',
        'length' => 150,
        'not null' => TRUE,
      ),
      'title' => array(
        'description' => 'Title',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'settings' => array(
        'description' => 'Settings',
        'type' => 'text',
        'serialize' => TRUE,
        'not null' => FALSE,
        'object default' => array(
          'scheduler' => array(),
          'launcher' => array(),
          'logger' => array(),
          'settings' => array(),
        ),
        'export callback' => '_ultimate_cron_job_export_settings',
      ),
    ),
    'primary key' => array(
      'jid',
    ),
    'unique keys' => array(
      'machine_name' => array(
        'name',
      ),
    ),
  );
  $schema['ultimate_cron_log'] = array(
    'description' => 'Logs',
    'fields' => array(
      'lid' => array(
        'description' => 'Lock ID',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'Name',
        'type' => 'varchar',
        'length' => 150,
        'not null' => TRUE,
      ),
      'log_type' => array(
        'description' => 'Log type',
        'type' => 'int',
        'size' => 'normal',
        'not null' => TRUE,
        'default' => 0,
      ),
      'start_time' => array(
        'description' => 'Timestamp of execution start',
        'type' => 'float',
        'size' => 'big',
        'not null' => TRUE,
        'default' => 0,
      ),
      'end_time' => array(
        'description' => 'Timestamp of execution end',
        'type' => 'float',
        'size' => 'big',
        'not null' => TRUE,
        'default' => 0,
      ),
      'uid' => array(
        'description' => 'User ID',
        'type' => 'int',
        'size' => 'normal',
        'not null' => TRUE,
        'default' => 0,
      ),
      'init_message' => array(
        'description' => 'Initial message',
        'type' => 'text',
        'not null' => FALSE,
      ),
      'message' => array(
        'description' => 'Message',
        'type' => 'text',
        'size' => 'big',
        'not null' => FALSE,
      ),
      'severity' => array(
        'description' => 'Max severity level of the execution',
        'type' => 'int',
        'size' => 'normal',
        'not null' => FALSE,
        'default' => -1,
      ),
    ),
    'primary key' => array(
      'lid',
    ),
    'indexes' => array(
      'idx_last' => array(
        'name',
        'start_time',
        'end_time',
        'log_type',
      ),
      'last_log' => array(
        'name',
        'log_type',
        'start_time',
      ),
    ),
  );
  $schema['ultimate_cron_lock'] = array(
    'description' => 'Locks',
    'fields' => array(
      'lid' => array(
        'description' => 'Lock ID',
        'type' => 'serial',
        'size' => 'big',
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'Name',
        'type' => 'varchar',
        'length' => 150,
        'not null' => TRUE,
      ),
      'current' => array(
        'description' => 'Current lock',
        'type' => 'int',
        'size' => 'big',
        'not null' => TRUE,
        'default' => 0,
      ),
      'expire' => array(
        'description' => 'Expiration time of lock',
        'type' => 'float',
        'size' => 'big',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'lid',
    ),
    'unique keys' => array(
      'idx_name' => array(
        'name',
        'current',
      ),
    ),
  );
  $schema['ultimate_cron_signal'] = array(
    'description' => 'Signals',
    'fields' => array(
      'job_name' => array(
        'description' => 'Name of job',
        'type' => 'varchar',
        'length' => 150,
        'not null' => TRUE,
      ),
      'signal_name' => array(
        'description' => 'Name of signal',
        'type' => 'varchar',
        'length' => 150,
        'not null' => TRUE,
      ),
      'claimed' => array(
        'description' => 'Is signal claimed',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'job_name',
      'signal_name',
    ),
  );
  $schema['cache_ultimate_cron'] = drupal_get_schema_unprocessed('system', 'cache');
  return $schema;
}