You are here

hosting_backup_queue.install in Hosting Site Backup Manager 6.2

Same filename and directory in other branches
  1. 7.3 hosting_backup_queue/hosting_backup_queue.install

File

hosting_backup_queue/hosting_backup_queue.install
View source
<?php

/**
 * Implemention of hook_install().
 */
function hosting_backup_queue_install() {
  drupal_install_schema('hosting_backup_queue');
}

/**
 * Implemention of hook_uninstall().
 */
function hosting_backup_queue_uninstall() {
  drupal_uninstall_schema('hosting_backup_queue');
}

/**
 * Implemention of hook_schema().
 */
function hosting_backup_queue_schema() {
  $schema = array();
  $schema['hosting_backup_queue_sites'] = array(
    'description' => t('A cache of the last backup times of all enabled sites.'),
    'fields' => array(
      'site_id' => array(
        'description' => t('The sites nid from the {node} table.'),
        'type' => 'int',
        'not null' => TRUE,
      ),
      'last_backup' => array(
        'description' => t('The timestamp of the last backup of this site.'),
        'type' => 'int',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'site_id',
    ),
    'indexes' => array(
      'last_backup' => array(
        'last_backup',
      ),
    ),
  );
  $schema['hosting_backup_queue_sites_settings'] = array(
    'description' => t('Site specific settings for backup schedules.'),
    'fields' => array(
      'site_id' => array(
        'description' => t('The sites nid from the {node} table.'),
        'type' => 'int',
        'not null' => TRUE,
      ),
      'status' => array(
        'description' => t('The status of this backup schedule.'),
        'type' => 'varchar',
        'length' => 20,
        'not null' => TRUE,
      ),
      'schedule' => array(
        'description' => t('The time between backups.'),
        'type' => 'int',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'site_id',
    ),
    'indexes' => array(
      'last_backup' => array(
        'status',
      ),
    ),
  );
  return $schema;
}
function hosting_backup_queue_update_6100() {
  $ret = array();
  $schema['hosting_backup_queue_sites_settings'] = array(
    'description' => t('Site specific settings for backup schedules.'),
    'fields' => array(
      'site_id' => array(
        'description' => t('The sites nid from the {node} table.'),
        'type' => 'int',
        'not null' => TRUE,
      ),
      'status' => array(
        'description' => t('The status of this backup schedule.'),
        'type' => 'varchar',
        'length' => 20,
        'not null' => TRUE,
      ),
      'schedule' => array(
        'description' => t('The time between backups.'),
        'type' => 'int',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'site_id',
    ),
    'indexes' => array(
      'last_backup' => array(
        'status',
      ),
    ),
  );
  foreach ($schema as $table => $spec) {
    db_create_table($ret, $table, $spec);
  }
  return $ret;
}