getVersion() 공개 메소드

Returns the Version instance for a given version in the format YYYYMMDDHHMMSS.
public getVersion ( string $version ) : Version
$version string The version string in the format YYYYMMDDHHMMSS.
리턴 Doctrine\DBAL\Migrations\Version
 private function markVersionsMigrated()
 {
     foreach ($this->migrations->getAvailableVersions() as $versionIdentifier) {
         $version = $this->migrations->getVersion($versionIdentifier);
         $version->markMigrated();
     }
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function rollback(EntityManager $em, \appbox $appbox, Configuration $conf)
 {
     // truncate created tables
     $this->emptyTables($em);
     // rollback schema
     $this->alterTablesDown($em);
     $version = $conf->getVersion('20131118000007');
     if ($version->isMigrated()) {
         $version->execute('down');
     }
     $version = $conf->getVersion('20131118000009');
     if ($version->isMigrated()) {
         $version->execute('down');
     }
 }
예제 #3
0
 private function mark($version, $all = false)
 {
     if (!$this->configuration->hasVersion($version)) {
         throw MigrationException::unknownMigrationVersion($version);
     }
     $version = $this->configuration->getVersion($version);
     if ($this->markMigrated && $this->configuration->hasVersionMigrated($version)) {
         $marked = true;
         if (!$all) {
             throw new \InvalidArgumentException(sprintf('The version "%s" already exists in the version table.', $version));
         }
     }
     if (!$this->markMigrated && !$this->configuration->hasVersionMigrated($version)) {
         $marked = false;
         if (!$all) {
             throw new \InvalidArgumentException(sprintf('The version "%s" does not exists in the version table.', $version));
         }
     }
     if (!isset($marked)) {
         if ($this->markMigrated) {
             $version->markMigrated();
         } else {
             $version->markNotMigrated();
         }
     }
 }
예제 #4
0
 /**
  * Test "--add" option on migrate already migrated version.
  *
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage The version "1233" already exists in the version table.
  */
 public function testAddOptionIfVersionAlreadyMigrated()
 {
     $this->configuration->registerMigration(1233, 'Doctrine\\DBAL\\Migrations\\Tests\\Stub\\Version1Test');
     $this->configuration->getVersion('1233')->markMigrated();
     $commandTester = new CommandTester($this->command);
     $commandTester->execute(array('--add' => true, 'version' => 1233), array('interactive' => false));
 }
예제 #5
0
 /**
  * {@inheritdoc}
  */
 public function rollback(EntityManager $em, \appbox $appbox, Configuration $conf)
 {
     $this->renameTable($em, 'down');
     // truncate created tables
     $this->emptyTables($em);
     // rollback schema
     $this->alterTablesDown($em);
     $version = $conf->getVersion('ftp-credential');
     if ($version->isMigrated()) {
         $version->execute('down');
     }
     $version = $conf->getVersion('user');
     if ($version->isMigrated()) {
         $version->execute('down');
     }
 }
예제 #6
0
 /**
  * {@inheritdoc}
  */
 public function getVersion($version)
 {
     $version = parent::getVersion($version);
     $this->container->callInjects($version->getMigration());
     return $version;
 }
 public function getVersion($version)
 {
     $this->doRegister();
     return parent::getVersion($version);
 }