getMigrationsColumnName() public method

Returns the migration column name
public getMigrationsColumnName ( ) : string
return string $migrationsColumnName The migration column name
 public function getMigrationsInfos()
 {
     $numExecutedUnavailableMigrations = count($this->executedUnavailableMigrations);
     $numNewMigrations = count(array_diff($this->availableMigrations, $this->executedMigrations));
     $infos = ['Name' => $this->configuration->getName() ? $this->configuration->getName() : 'Doctrine Database Migrations', 'Database Driver' => $this->configuration->getConnection()->getDriver()->getName(), 'Database Name' => $this->configuration->getConnection()->getDatabase(), 'Configuration Source' => $this->configuration instanceof AbstractFileConfiguration ? $this->configuration->getFile() : 'manually configured', 'Version Table Name' => $this->configuration->getMigrationsTableName(), 'Version Column Name' => $this->configuration->getMigrationsColumnName(), 'Migrations Namespace' => $this->configuration->getMigrationsNamespace(), 'Migrations Directory' => $this->configuration->getMigrationsDirectory(), 'Previous Version' => $this->getFormattedVersionAlias('prev'), 'Current Version' => $this->getFormattedVersionAlias('current'), 'Next Version' => $this->getFormattedVersionAlias('next'), 'Latest Version' => $this->getFormattedVersionAlias('latest'), 'Executed Migrations' => count($this->executedMigrations), 'Executed Unavailable Migrations' => $numExecutedUnavailableMigrations, 'Available Migrations' => count($this->availableMigrations), 'New Migrations' => $numNewMigrations];
     return $infos;
 }
Example #2
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);
     $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);
 }
Example #3
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);
 }
Example #4
0
 /**
  * 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 ? Version::DIRECTION_DOWN : Version::DIRECTION_UP;
     $this->outputWriter->write(sprintf("# Migrating from %s to %s\n", $from, $to));
     $sqlWriter = new SqlFileWriter($this->configuration->getMigrationsColumnName(), $this->configuration->getMigrationsTableName(), $path, $this->outputWriter);
     return $sqlWriter->write($sql, $direction);
 }
 public function getMigrationsInfos()
 {
     $formattedVersions = [];
     foreach (['prev', 'current', 'next', 'latest'] as $alias) {
         $version = $this->configuration->resolveVersionAlias($alias);
         if ($version === null) {
             if ($alias == 'next') {
                 $formattedVersions[$alias] = 'Already at latest version';
             } elseif ($alias == 'prev') {
                 $formattedVersions[$alias] = 'Already at first version';
             }
         } elseif ($version === '0') {
             $formattedVersions[$alias] = '<comment>0</comment>';
         } else {
             $formattedVersions[$alias] = $this->configuration->getDateTime($version) . ' (<comment>' . $version . '</comment>)';
         }
     }
     $numExecutedUnavailableMigrations = count($this->executedUnavailableMigrations);
     $numNewMigrations = count(array_diff($this->availableMigrations, $this->executedMigrations));
     $infos = ['Name' => $this->configuration->getName() ? $this->configuration->getName() : 'Doctrine Database Migrations', 'Database Driver' => $this->configuration->getConnection()->getDriver()->getName(), 'Database Name' => $this->configuration->getConnection()->getDatabase(), 'Configuration Source' => $this->configuration instanceof AbstractFileConfiguration ? $this->configuration->getFile() : 'manually configured', 'Version Table Name' => $this->configuration->getMigrationsTableName(), 'Version Column Name' => $this->configuration->getMigrationsColumnName(), 'Migrations Namespace' => $this->configuration->getMigrationsNamespace(), 'Migrations Directory' => $this->configuration->getMigrationsDirectory(), 'Previous Version' => $formattedVersions['prev'], 'Current Version' => $formattedVersions['current'], 'Next Version' => $formattedVersions['next'], 'Latest Version' => $formattedVersions['latest'], 'Executed Migrations' => count($this->executedMigrations), 'Executed Unavailable Migrations' => $numExecutedUnavailableMigrations, 'Available Migrations' => count($this->availableMigrations), 'New Migrations' => $numNewMigrations];
     return $infos;
 }
Example #6
0
 public function markNotMigrated()
 {
     $this->configuration->createMigrationTable();
     $this->connection->delete($this->configuration->getMigrationsTableName(), [$this->configuration->getMigrationsColumnName() => $this->version]);
 }