Example #1
0
 protected function dropTables()
 {
     $db = Di::getDefault()->get('db_centreon');
     $platform = new CentreonMysqlPlatform($db);
     // Get current DB State
     $currentDb = self::initializeCurrentSchema($platform);
     // Retreive target DB State
     $updatedAppData = new \AppData($platform);
     $appDataObject = new \XmlToAppData(new CentreonMysqlPlatform($db), null, 'utf-8');
     $updatedAppData->joinAppDatas(array($appDataObject->parseFile(__DIR__ . '/data/empty.xml')));
     unset($appDataObject);
     /* @todo Fatorize */
     $diff = \PropelDatabaseComparator::computeDiff($currentDb, $updatedAppData->getDatabase('centreon'), false);
     if (false !== $diff) {
         $strDiff = $platform->getModifyDatabaseDDL($diff);
         $sqlToBeExecuted = \PropelSQLParser::parseString($strDiff);
         \PropelSQLParser::executeString($strDiff, $db);
     }
 }