Exemple #1
0
 /**
  * Return the configuration needed for Migrations.
  *
  * @return \Doctrine\DBAL\Migrations\Configuration\Configuration
  */
 protected function getMigrationConfiguration()
 {
     $this->output = array();
     $that = $this;
     $outputWriter = new \Doctrine\DBAL\Migrations\OutputWriter(function ($message) use($that) {
         $that->output[] = $message;
     });
     $connection = $this->entityManager->getConnection();
     if ($connection->getSchemaManager()->tablesExist(array('flow3_doctrine_migrationstatus')) === TRUE) {
         // works for SQLite, MySQL, PostgreSQL, Oracle
         // does not work for SQL Server
         $connection->exec('ALTER TABLE flow3_doctrine_migrationstatus RENAME TO flow_doctrine_migrationstatus');
     }
     $configuration = new \Doctrine\DBAL\Migrations\Configuration\Configuration($connection, $outputWriter);
     $configuration->setMigrationsNamespace('TYPO3\\Flow\\Persistence\\Doctrine\\Migrations');
     $configuration->setMigrationsDirectory(\TYPO3\Flow\Utility\Files::concatenatePaths(array(FLOW_PATH_DATA, 'DoctrineMigrations')));
     $configuration->setMigrationsTableName('flow_doctrine_migrationstatus');
     $configuration->createMigrationTable();
     $databasePlatformName = $this->getDatabasePlatformName();
     foreach ($this->packageManager->getActivePackages() as $package) {
         $path = \TYPO3\Flow\Utility\Files::concatenatePaths(array($package->getPackagePath(), 'Migrations', $databasePlatformName));
         if (is_dir($path)) {
             $configuration->registerMigrationsFromDirectory($path);
         }
     }
     return $configuration;
 }
 /**
  * Return the configuration needed for Migrations.
  *
  * @return \Doctrine\DBAL\Migrations\Configuration\Configuration
  */
 protected function getMigrationConfiguration()
 {
     $this->output = array();
     $that = $this;
     $outputWriter = new \Doctrine\DBAL\Migrations\OutputWriter(function ($message) use($that) {
         $that->output[] = $message;
     });
     $connection = $this->entityManager->getConnection();
     $schemaManager = $connection->getSchemaManager();
     if ($schemaManager->tablesExist(array('flow3_doctrine_migrationstatus')) === true) {
         $schemaManager->renameTable('flow3_doctrine_migrationstatus', self::DOCTRINE_MIGRATIONSTABLENAME);
     }
     $configuration = new \Doctrine\DBAL\Migrations\Configuration\Configuration($connection, $outputWriter);
     $configuration->setMigrationsNamespace('TYPO3\\Flow\\Persistence\\Doctrine\\Migrations');
     $configuration->setMigrationsDirectory(\TYPO3\Flow\Utility\Files::concatenatePaths(array(FLOW_PATH_DATA, 'DoctrineMigrations')));
     $configuration->setMigrationsTableName(self::DOCTRINE_MIGRATIONSTABLENAME);
     $configuration->createMigrationTable();
     $databasePlatformName = $this->getDatabasePlatformName();
     foreach ($this->packageManager->getActivePackages() as $package) {
         $path = \TYPO3\Flow\Utility\Files::concatenatePaths(array($package->getPackagePath(), 'Migrations', $databasePlatformName));
         if (is_dir($path)) {
             $configuration->registerMigrationsFromDirectory($path);
         }
     }
     return $configuration;
 }
Exemple #3
0
 /**
  * Return the configuration needed for Migrations.
  *
  * @return \Doctrine\DBAL\Migrations\Configuration\Configuration
  */
 protected function getMigrationConfiguration()
 {
     $this->output = array();
     $that = $this;
     $outputWriter = new \Doctrine\DBAL\Migrations\OutputWriter(function ($message) use($that) {
         $that->output[] = $message;
     });
     $configuration = new \Doctrine\DBAL\Migrations\Configuration\Configuration($this->entityManager->getConnection(), $outputWriter);
     $configuration->setMigrationsNamespace('TYPO3\\FLOW3\\Persistence\\Doctrine\\Migrations');
     $configuration->setMigrationsDirectory(\TYPO3\FLOW3\Utility\Files::concatenatePaths(array(FLOW3_PATH_DATA, 'DoctrineMigrations')));
     $configuration->setMigrationsTableName('flow3_doctrine_migrationstatus');
     $configuration->createMigrationTable();
     $databasePlatformName = $this->getDatabasePlatformName();
     foreach ($this->packageManager->getActivePackages() as $package) {
         $configuration->registerMigrationsFromDirectory(\TYPO3\FLOW3\Utility\Files::concatenatePaths(array($package->getPackagePath(), 'Migrations', $databasePlatformName)));
     }
     return $configuration;
 }