Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run a doctrine 2 migration commandline without interaction?

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);
like image 370
tom Avatar asked Aug 10 '10 11:08

tom


2 Answers

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.

like image 85
AKCD Avatar answered Oct 04 '22 06:10

AKCD


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);
?>
like image 31
Kees Schepers Avatar answered Oct 04 '22 07:10

Kees Schepers