You are here

function backup_migrate_schema in Backup and Migrate 6.3

Same name and namespace in other branches
  1. 8.2 backup_migrate.install \backup_migrate_schema()
  2. 8.3 backup_migrate.install \backup_migrate_schema()
  3. 6.2 backup_migrate.install \backup_migrate_schema()
  4. 7.3 backup_migrate.install \backup_migrate_schema()
  5. 7.2 backup_migrate.install \backup_migrate_schema()

Implementation of hook_schema().

File

./backup_migrate.install, line 21
Install hooks for Backup and Migrate.

Code

function backup_migrate_schema() {
  $schema['backup_migrate_profiles'] = array(
    'export' => array(
      'key' => 'machine_name',
      'key name' => 'Profile ID',
      'admin_title' => 'name',
      'primary key' => 'profile_id',
      'identifier' => 'item',
      // Exports will be defined as $preset
      'default hook' => 'exportables_backup_migrate_profiles',
      // Function hook name.
      'api' => array(
        'owner' => 'backup_migrate',
        'api' => 'backup_migrate_exportables',
        // Base name for api include files.
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'profile_id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        'no export' => TRUE,
      ),
      'machine_name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
        'description' => t('The primary identifier for a profile.'),
      ),
      'name' => array(
        'description' => t('The name of the profile.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'filename' => array(
        'description' => t('The base pattern (including unreplaced tokens) for the name of the backup file.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'append_timestamp' => array(
        'description' => t('Append a timestamp to the filename.'),
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'timestamp_format' => array(
        'description' => t('The format of the timestamp.'),
        'type' => 'varchar',
        'length' => 14,
        'not null' => TRUE,
      ),
      'filters' => array(
        'description' => t('The filter settings for the profile.'),
        'type' => 'text',
        'not null' => TRUE,
        'serialize' => TRUE,
        'serialized default' => 'a:0:{}',
      ),
    ),
    'primary key' => array(
      'profile_id',
    ),
  );
  $schema['backup_migrate_destinations'] = array(
    'export' => array(
      'key' => 'machine_name',
      'key name' => 'Destination ID',
      'admin_title' => 'name',
      'primary key' => 'destination_id',
      'identifier' => 'item',
      // Exports will be defined as $preset
      'default hook' => 'exportables_backup_migrate_destinations',
      // Function hook name.
      'api' => array(
        'owner' => 'backup_migrate',
        'api' => 'backup_migrate_exportables',
        // Base name for api include files.
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'destination_id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        'no export' => TRUE,
      ),
      'machine_name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
        'description' => t('The primary identifier for a destination.'),
      ),
      'name' => array(
        'description' => t('The name of the destination.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'subtype' => array(
        'description' => t('The type of the destination.'),
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ),
      'location' => array(
        'description' => t('The the location string of the destination.'),
        'type' => 'text',
        'not null' => TRUE,
      ),
      'settings' => array(
        'description' => t('Other settings for the destination.'),
        'type' => 'text',
        'not null' => TRUE,
        'serialize' => TRUE,
        'serialized default' => 'a:0:{}',
      ),
    ),
    'primary key' => array(
      'destination_id',
    ),
  );
  $schema['backup_migrate_sources'] = array(
    'export' => array(
      'key' => 'machine_name',
      'key name' => 'Source ID',
      'admin_title' => 'name',
      'primary key' => 'source_id',
      'identifier' => 'item',
      // Exports will be defined as $preset
      'default hook' => 'exportables_backup_migrate_sources',
      // Function hook name.
      'api' => array(
        'owner' => 'backup_migrate',
        'api' => 'backup_migrate_exportables',
        // Base name for api include files.
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'source_id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        'no export' => TRUE,
      ),
      'machine_name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '0',
        'description' => t('The primary identifier for a source.'),
      ),
      'name' => array(
        'description' => t('The name of the source.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'subtype' => array(
        'description' => t('The type of the source.'),
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ),
      'location' => array(
        'description' => t('The the location string of the source.'),
        'type' => 'text',
        'not null' => TRUE,
      ),
      'settings' => array(
        'description' => t('Other settings for the source.'),
        'type' => 'text',
        'not null' => TRUE,
        'serialize' => TRUE,
        'serialized default' => 'a:0:{}',
      ),
    ),
    'primary key' => array(
      'source_id',
    ),
  );
  $schema['backup_migrate_schedules'] = array(
    'export' => array(
      'key' => 'machine_name',
      'key name' => 'Source ID',
      'admin_title' => 'name',
      'primary key' => 'schedule_id',
      'identifier' => 'item',
      // Exports will be defined as $preset
      'default hook' => 'exportables_backup_migrate_schedules',
      // Function hook name.
      'api' => array(
        'owner' => 'backup_migrate',
        'api' => 'backup_migrate_exportables',
        // Base name for api include files.
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'schedule_id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        'no export' => TRUE,
      ),
      'machine_name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
        'description' => t('The primary identifier for a profile.'),
      ),
      'name' => array(
        'description' => t('The name of the profile.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'source_id' => array(
        'description' => t('The {backup_migrate_destination}.destination_id of the source to backup from.'),
        'type' => 'varchar',
        'length' => 255,
        'default' => 'db',
        'not null' => TRUE,
      ),
      'destination_id' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
        'description' => t('The {backup_migrate_destination}.destination_id of the destination to back up to.'),
      ),
      'copy_destination_id' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '0',
        'description' => t('A second {backup_migrate_destination}.destination_id of the destination to copy the backup to.'),
      ),
      'profile_id' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
        'description' => t('The primary identifier for a profile.'),
      ),
      'keep' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The number of backups to keep.'),
      ),
      'period' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The number of seconds between backups.'),
      ),
      'enabled' => array(
        'description' => t('Whether the schedule is enabled.'),
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'cron' => array(
        'description' => t('Whether the schedule should be run during built in cron, Elysia cron or not at all.'),
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => 'builtin',
      ),
      'cron_schedule' => array(
        'description' => t('The cron schedule to run on.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0 4 * * *',
      ),
    ),
    'primary key' => array(
      'schedule_id',
    ),
  );
  return $schema;
}