markMigrated() публичный Метод

public markMigrated ( )
Пример #1
0
 /**
  * @param Connection $connection
  * @param AppKernel  $kernel
  */
 public function preUpdate(Connection $connection, AppKernel $kernel)
 {
     /** @var \Symfony\Component\HttpKernel\Bundle\Bundle[] $bundles */
     $bundles = $kernel->getBundles();
     $isPortfolioBundleInstalled = false;
     foreach ($bundles as $bundle) {
         if ('IcapPortfolioBundle' === $bundle->getName()) {
             $isPortfolioBundleInstalled = true;
         }
     }
     if ($connection->getSchemaManager()->tablesExist(['icap__portfolio_widget_badges'])) {
         if ($isPortfolioBundleInstalled) {
             $this->log('Found existing database schema: skipping install migration...');
             $config = new Configuration($connection);
             $config->setMigrationsTableName('doctrine_icapbadgebundle_versions');
             $config->setMigrationsNamespace('claro_badge');
             // required but useless
             $config->setMigrationsDirectory('claro_badge');
             // idem
             try {
                 $version = new Version($config, '20150929141509', 'stdClass');
                 $version->markMigrated();
             } catch (\Exception $e) {
                 $this->log('Already migrated');
             }
         } else {
             $this->log('Deleting badges tables for portfolio...');
             $connection->getSchemaManager()->dropTable('icap__portfolio_widget_badges_badge');
             $connection->getSchemaManager()->dropTable('icap__portfolio_widget_badges');
             $this->log('badges tables for portfolio deleted.');
         }
     }
 }
Пример #2
0
 public function preInstall()
 {
     if ($this->conn->getSchemaManager()->tablesExist(['claro_message'])) {
         $this->log('Found existing database schema: skipping install migration...');
         $config = new Configuration($this->conn);
         $config->setMigrationsTableName('doctrine_clarolinemessagebundle_versions');
         $config->setMigrationsNamespace('claro_message');
         // required but useless
         $config->setMigrationsDirectory('claro_message');
         // idem
         $version = new Version($config, '20150429114010', 'stdClass');
         $version->markMigrated();
     }
 }
Пример #3
0
 private function skipInstallIfMigratingFromCore()
 {
     if ($this->conn->getSchemaManager()->tablesExist(['claro_event'])) {
         $this->log('Found existing database schema: skipping install migration...');
         $config = new Configuration($this->conn);
         $config->setMigrationsTableName('doctrine_clarolineagendabundle_versions');
         $config->setMigrationsNamespace('claro_event');
         // required but useless
         $config->setMigrationsDirectory('claro_event');
         // idem
         $version = new Version($config, '20150429110105', 'stdClass');
         $version->markMigrated();
     }
 }