示例#1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configuration = CodePax_Config::getInstance(CONFIG_PATH . 'config.ini');
     try {
         $sql_engine = CodePax_DbVersioning_SqlEngines_Factory::factory($configuration);
         $dir = ABS_PATH . 'app' . DIRECTORY_SEPARATOR . 'db' . DIRECTORY_SEPARATOR;
         switch (strtolower($configuration->db_engine)) {
             case 'mysql':
                 $sql_file_name = 'db_versions_mysql.sql';
                 break;
             case 'pgsql':
                 $sql_file_name = 'db_versions_pgsql.sql';
                 break;
             case 'sqlsrv':
                 $sql_file_name = 'db_versions_sqlsrv.sql';
                 break;
         }
         $sql_engine->executeChangeScript($dir . $sql_file_name);
     } catch (CodePax_DbVersioning_Exception $e) {
         $output->writeln('An error ocurred: ' . $e->getMessage());
         exit;
     } catch (Exception $e) {
         $output->writeln('Generic error: ' . $e->getMessage());
         exit;
     }
     $output->writeln('CodePax successfully installed!');
 }
示例#2
0
 /**
  * Create required instances
  *
  * @return void
  * */
 public function __construct()
 {
     // create the sql handler
     $this->sql_engine = CodePax_DbVersioning_SqlEngines_Factory::factory();
     // factory the Model that handles the versions table
     $this->db_versions_model = CodePax_DbVersions::factory();
     // set the structure version
     $this->setLatestDbVersion();
     // set the data version
     $this->setLatestDataDbVersion();
 }
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@codepax.com so we can send you a copy immediately.
 * */
/**
 * Utility script to generate the table that keeps track
 * of database versions
 *
 * @category CodePax
 * @package Utils
 * @copyright Copyright (c) 2012 Zitec COM srl, Romania
 * @license New BSD http://www.codepax.com/license.html
 */
require '../application/bootstrap.php';
try {
    $sql_engine = CodePax_DbVersioning_SqlEngines_Factory::factory();
    $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR;
    switch (DB_ENGINE) {
        case 'mysql':
            $sql_file_name = 'db_versions_mysql.sql';
            break;
        case 'pgsql':
            $sql_file_name = 'db_versions_pgsql.sql';
            break;
        case 'sqlsrv':
            $sql_file_name = 'db_versions_sqlsrv.sql';
            break;
    }
    $sql_engine->executeChangeScript($dir . $sql_file_name);
} catch (CodePax_DbVersioning_Exception $dbv_e) {
    echo 'An error ocurred: ' . $dbv_e->getMessage();
示例#4
0
 /**
  * Class constructor for the environment object
  *
  * @param $configuration
  * @throws CodePax_DbVersioning_Exception
  */
 public function __construct($configuration)
 {
     // set the configuration param
     $this->configuration = $configuration;
     // set the files manager instance
     $this->filesManager = new CodePax_DbVersioning_Files_Manager($this->configuration);
     // create the sql handler
     $this->sql_engine = CodePax_DbVersioning_SqlEngines_Factory::factory($this->configuration);
     // factory the Model that handles the versions table
     $this->db_versions_model = CodePax_DbVersions::factory($this->configuration);
     // set the structure version
     $this->setLatestDbVersion();
     // set the data version
     $this->setLatestDataDbVersion();
 }