コード例 #1
0
ファイル: DatabaseTestCase.php プロジェクト: intfrr/opencfp
 protected function migrate()
 {
     $input = new ArgvInput(['phinx', 'migrate', '--environment=memory']);
     $output = new NullOutput();
     $phinx = new Phinx\Console\PhinxApplication();
     $phinx->setAutoExit(false);
     $phinx->run($input, $output);
     /** @var Migrate $migrateCommand */
     $migrateCommand = $phinx->get('migrate');
     $adapter = $migrateCommand->getManager()->getEnvironment('memory')->getAdapter();
     /** @var PDO $pdo */
     $this->phinxPdo = $adapter->getConnection();
 }
コード例 #2
0
ファイル: Migration.php プロジェクト: heg-arc-ne/cscart
 public function __call($name, $arguments)
 {
     $config_path = Registry::get('config.dir.root') . '/app/Tygh/UpgradeCenter/Migrations/config.migrations.php';
     switch ($name) {
         case 'migrate':
             $_SERVER['argv'] = array('phinx', 'migrate', '-c' . $config_path, '-edevelopment');
             break;
         case 'rollback':
             $_SERVER['argv'] = array('phinx', 'rollback', '-c' . $config_path, '-edevelopment');
             break;
         default:
             return false;
     }
     $output = new Output();
     $output->setConfig($this->config);
     $app = new \Phinx\Console\PhinxApplication('0.3.7');
     $app->setAutoExit(false);
     $app->run(null, $output);
 }
コード例 #3
0
ファイル: run.php プロジェクト: hashir-dhattiwala/vfmagento
$_SERVER['PHINX_MIGRATIONS_DIR'] = $mageRoot . 'app/code/local/Elite/migrations';
$_SERVER['PHINX_HOST'] = $dbinfo['host'];
$_SERVER['PHINX_USER'] = $dbinfo['username'];
$_SERVER['PHINX_PASSWORD'] = $dbinfo['password'];
$_SERVER['PHINX_DBNAME'] = $dbinfo['dbname'];
$_SERVER['PHINX_PORT'] = 3306;
use Symfony\Component\Console\Output\Output;
file_put_contents($mageRoot . 'var/vf-upgrade-progress.txt', '');
chmod($mageRoot . 'var/vf-upgrade-progress.txt', 0777);
class BufferedOutput extends Output
{
    protected $buffer;
    public function doWrite($message, $newline)
    {
        global $mageRoot;
        $h = fopen($mageRoot . 'var/vf-upgrade-progress.txt', 'a');
        fwrite($h, $message . ($newline ? PHP_EOL : ''));
        $this->buffer .= $message . ($newline ? PHP_EOL : '');
    }
    public function getBuffer()
    {
        return $this->buffer;
    }
}
ini_set('display_errors', 1);
error_reporting(E_ALL);
$input = new \Symfony\Component\Console\Input\StringInput('migrate -c ' . $mageRoot . 'app/code/local/Elite/phinx.yml -e main');
$output = new BufferedOutput();
$app = new Phinx\Console\PhinxApplication('0.2.8');
$app->setAutoExit(false);
$app->run($input, $output);