Skip to content

Instantly share code, notes, and snippets.

@gwagroves
Created February 16, 2015 15:37
Show Gist options
  • Save gwagroves/03546aa1ccd8b23d6f49 to your computer and use it in GitHub Desktop.
Save gwagroves/03546aa1ccd8b23d6f49 to your computer and use it in GitHub Desktop.
Phinx: Run migration from inside PHP script
use Phinx\Config\Config;
use Phinx\Migration\Manager;
use Symfony\Component\Console\Output\NullOutput;
$migrationspath = 'path/to/migrations/folder';
$config = new Config(array(
'paths' => array(
'migrations' => $migrationspath
),
'environments' => array(
'testing' => array(
'adapter' => 'sqlite',
'memory' => true
)
)
));
$output = new NullOutput();
$manager = new Manager($config, $output);
$manager->migrate('testing');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment