How can I run a doctrine 2 migration command without interaction?
Currently I have following command which runs on the setup of my Unit Tests. But It always prompt for a Yes/No user input, even when I use the --no-interaction option.
$input = new Symfony\Components\Console\Input\ArrayInput(
array(
'migrations:migrate',
'--configuration' => APPLICATION_PATH . '/../doctrine/migrations.xml',
'--no-interaction',
)
);
$cli->run($input);
I just stumbled over your post, as I was having the same problem. Doctrine Migrations seem to been updated meanwhile (I guess: https://github.com/doctrine/migrations/commit/5b2751f149bc38d38870578f753c2193eb36e742).
Hence
php app/console --no-interaction doctrine:migrations:migrate
now works fine.
I don't like Tom his approach and there is a other way to get this done:
<?php
$input = new Symfony\Components\Console\Input\ArrayInput(
array(
'migrations:migrate',
'--configuration' => APPLICATION_PATH . '/../doctrine/migrations.xml',
)
);
$input->setInteractive(false);
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With