Reputation: 8369
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);
Upvotes: 29
Views: 18668
Reputation: 1546
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.
Upvotes: 62
Reputation: 2258
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);
?>
Upvotes: 13