/** * Wrap a method call in pushTime/popTime calls * * @param string method name * @param string string that identifies this call (comes in () after the call name in output) * @param array array of arguments */ private function wrapCall($name, $ident, array $args) { self::pushTime('', "-- {$name}({$ident})", ' -> '); call_user_func_array(array(Migration_Adapter::getAdapter(), $name), $args); // since this call likely made some change to the database, go ahead and rebuild // cached data // QFrame_Db_Table::scanDb(); self::popTime(); }
krsort($migrations); } // Sort migrations that need to run and run 'em foreach ($migrations as $version => $migration) { // continue to the next iteration if we are already past this version $current = Migration_Adapter::getAdapter()->getSchemaVersion(); if ($migrateUp && $version <= $current || !$migrateUp && $version > $current) { continue; } // break from the loop if we have reached the desired version if ($migrateUp && $version > $target || !$migrateUp && $version <= $target) { break; } // print a message indicating that we are starting a migration Migration::pushTime("== {$version} {$migration}: migrat", 'ing ', 'ed ', true, '=', 80); // create an instance of the migration class and call it's up (or down) method $class = new ReflectionClass($migration); $instance = $class->newInstance(); if ($migrateUp) { Migration_Adapter::getAdapter()->up($instance, $version); } else { Migration_Adapter::getAdapter()->down($instance, $version); } // print a message indicating that we are down with this migration Migration::popTime(); } // If we have gotten to this point make sure the schema version is set to the target (especially // important for migrating down since we never actually run the target migration) Migration_Adapter::getAdapter()->setSchemaVersion($target); // Print a final newline echo "\n";