Index: backup_migrate.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/backup_migrate/backup_migrate.install,v
retrieving revision 1.2.2.5
diff -u -p -r1.2.2.5 backup_migrate.install
--- backup_migrate.install	9 Jan 2011 15:01:15 -0000	1.2.2.5
+++ backup_migrate.install	25 Jan 2011 04:58:16 -0000
@@ -390,3 +390,52 @@ function backup_migrate_update_7200() {
     }
   }
 }
+
+
+/**
+ * Redo some of the updates from 2005 for those who downloaded the version which was missing that update.
+ */
+function backup_migrate_update_7201() {
+  require_once './'. drupal_get_path('module', 'backup_migrate') .'/includes/crud.inc';
+  require_once './'. drupal_get_path('module', 'backup_migrate') .'/includes/profiles.inc';
+
+  // Add the source field to the schedule
+  if (!db_field_exists('backup_migrate_schedules', 'source_id')) {
+    // Change the db_url:default id to simply 'db'
+    // Change the defined db keys from db_url:key to db:key.
+    db_query("UPDATE {backup_migrate_schedules} SET destination_id = 'db' WHERE destination_id = 'db_url:default'");
+    db_query("UPDATE {backup_migrate_schedules} SET destination_id = REPLACE(destination_id, 'db_url:', 'db:')");
+    db_query("UPDATE {backup_migrate_profiles} SET source_id = 'db' WHERE source_id = 'db_url:default'");
+    db_query("UPDATE {backup_migrate_profiles} SET source_id = REPLACE(source_id, 'db_url:', 'db:')");
+
+    db_add_field('backup_migrate_schedules', 'source_id', array('description' => t('The db source to backup from.'), 'type' => 'varchar', 'length' => 32, 'default' => 'db', 'not null' => TRUE));
+
+  // Copy source data from profiles to schedules.
+    $result = db_query('SELECT p.source_id, s.schedule_id FROM {backup_migrate_schedules} s LEFT JOIN {backup_migrate_profiles} p ON s.profile_id = p.profile_id', array(), array('fetch' => PDO::FETCH_ASSOC));
+    foreach ($result as $schedule) {
+      if (!$schedule['source_id']) {
+        $schedule['source_id'] = 'db';
+      }
+      db_query("UPDATE {backup_migrate_schedules} SET source_id = '". $schedule['source_id'] ."' WHERE schedule_id = '". $schedule['profile_id'] ."'");
+    }
+
+    db_drop_field('backup_migrate_profiles', 'source_id');
+  }
+
+  // Copy the no-data and exclude tables settings into the 'filter' field.
+  $result = db_query('SELECT * FROM {backup_migrate_profiles}', array(), array('fetch' => PDO::FETCH_ASSOC));
+  foreach ($result as $item) {
+    if (isset($item['nodata_tables']) && isset($item['exclude_tables'])) {
+      $profile = backup_migrate_get_profile($item['profile_id']);
+      $profile->filters['nodata_tables'] = unserialize($item['nodata_tables']);
+      $profile->filters['exclude_tables'] = unserialize($item['exclude_tables']);
+      $profile->save();
+    }
+  }
+  if (db_field_exists('backup_migrate_profiles', 'nodata_tables')) {
+    db_drop_field('backup_migrate_profiles', 'nodata_tables');
+  }
+  if (db_field_exists('backup_migrate_profiles', 'exclude_tables')) {
+    db_drop_field('backup_migrate_profiles', 'exclude_tables');
+  }  
+}
