예제 #1
0
 /**
  * @param  File $file
  * @return int  number of executed queries
  */
 protected function execute(File $file)
 {
     $this->driver->beginTransaction();
     $migration = new Migration();
     $migration->group = $file->group->name;
     $migration->filename = $file->name;
     $migration->checksum = $file->checksum;
     $migration->executedAt = new DateTime('now');
     $this->driver->insertMigration($migration);
     try {
         $queriesCount = $this->getExtension($file->extension)->execute($file);
     } catch (\Exception $e) {
         $this->driver->rollbackTransaction();
         throw new ExecutionException(sprintf('Executing migration "%s" has failed.', $file->path), NULL, $e);
     }
     $this->driver->markMigrationAsReady($migration);
     $this->driver->commitTransaction();
     return $queriesCount;
 }
예제 #2
0
 /**
  * @param  File
  * @return int  number of executed queries
  */
 protected function execute(File $file)
 {
     $this->driver->beginTransaction();
     // Note: MySQL implicitly commits after some operations, such as CREATE or ALTER TABLE, see http://dev.mysql.com/doc/refman/5.6/en/implicit-commit.html
     // proto se radeji kontroluje jestli bylo dokonceno
     $migration = new Migration();
     $migration->group = $file->group->name;
     $migration->filename = $file->name;
     $migration->checksum = $file->checksum;
     $migration->executedAt = new DateTime('now');
     $this->driver->insertMigration($migration);
     try {
         $queriesCount = $this->getExtension($file->extension)->execute($file);
     } catch (\Exception $e) {
         $this->driver->rollbackTransaction();
         throw new ExecutionException(sprintf('Executing migration "%s" has failed.', $file->getPath()), NULL, $e);
     }
     $this->driver->markMigrationAsReady($migration);
     $this->driver->commitTransaction();
     return $queriesCount;
 }