Пример #1
0
 /**
  * Write a migration SQL file to the given path
  *
  * @param string $path      The path to write the migration SQL file.
  * @param string $direction The direction to execute.
  *
  * @return boolean $written
  */
 public function writeSqlFile($path, $direction = self::DIRECTION_UP)
 {
     $queries = $this->execute($direction, true);
     if (!empty($this->params)) {
         throw MigrationException::migrationNotConvertibleToSql($this->class);
     }
     $this->outputWriter->write("\n-- Version " . $this->version . "\n");
     $sqlQueries = [$this->version => $queries];
     $sqlWriter = new SqlFileWriter($this->configuration->getMigrationsColumnName(), $this->configuration->getMigrationsTableName(), $path, $this->outputWriter);
     return $sqlWriter->write($sqlQueries, $direction);
 }