You are here

function migrate_update_6001 in Migrate 6.2

Same name and namespace in other branches
  1. 6 migrate.install \migrate_update_6001()

Convert lastimported datetime field to lastimportedtime int field.

File

./migrate.install, line 182
Migrate module installation

Code

function migrate_update_6001() {
  $ret = array();
  db_add_field($ret, 'migrate_status', 'lastimportedtime', array(
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => FALSE,
    'description' => 'Date and time of last completed import',
  ));
  $result = db_query("SELECT machine_name, lastimported\n                      FROM {migrate_status}");
  while ($row = db_fetch_object($result)) {
    $lastimportedtime = strtotime($row->lastimported);
    db_query("UPDATE {migrate_status}\n              SET lastimportedtime=%d\n              WHERE machine_name='%s'", $lastimportedtime, $row->machine_name);
  }
  db_drop_field($ret, 'migrate_status', 'lastimported');
  $ret[] = t('Converted lastimported datetime field to lastimportedtime int field');
  return $ret;
}