You are here

function backup_migrate_update_6205 in Backup and Migrate 6.2

Increase the length of all ids to 255.

File

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

Code

function backup_migrate_update_6205() {
  $schema['backup_migrate_profiles'] = array(
    'fields' => array(
      'profile_id' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
        'description' => t('The primary identifier for a profile.'),
      ),
      'filename' => array(
        'description' => t('The base pattern (including unreplaced tokens) for the name of the backup file.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
    ),
  );
  $schema['backup_migrate_destinations'] = array(
    'fields' => array(
      'destination_id' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
        'description' => t('The primary identifier for a profile.'),
      ),
    ),
  );
  $schema['backup_migrate_schedules'] = array(
    'fields' => array(
      'schedule_id' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
        'description' => t('The primary identifier for a profile.'),
      ),
      '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.'),
      ),
      'profile_id' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
        'description' => t('The primary identifier for a profile.'),
      ),
    ),
  );
  $fields = array(
    'backup_migrate_profiles' => array(
      'profile_id',
    ),
    'backup_migrate_destinations' => array(
      'destination_id',
    ),
    'backup_migrate_schedules' => array(
      'schedule_id',
      'source_id',
      'destination_id',
      'profile_id',
    ),
  );
  $ret = array();

  // Update the length of each of the ids
  foreach ($schema as $table => $ids) {
    foreach ($ids['fields'] as $field => $spec) {
      db_change_field($ret, $table, $field, $field, $spec);
    }
  }
  return $ret;
}