/**
* Write a migration SQL file to the given path
*
* @param string $path The path to write the migration SQL file.
* @param string $to The version to migrate to.
*
* @return boolean $written
*/
public function writeSqlFile($path, $to = null)
{
$sql = $this->getSql($to);
$from = $this->configuration->getCurrentVersion();
if ($to === null) {
$to = $this->configuration->getLatestVersion();
}
$direction = $from > $to ? 'down' : 'up';
$this->outputWriter->write(sprintf("# Migrating from %s to %s\n", $from, $to));
$sqlWriter = new SqlFileWriter($this->configuration->getMigrationsTableName(), $path, $this->outputWriter);
return $sqlWriter->write($sql, $direction);
}