質問

だから私は私のAntビルドファイルにこのターゲットを持っています:

<target name="migrate" description="Migrate the database">
    <exec executable="${basedir}/vendor/bin/doctrine-module" failonerror="true">
        <arg line="migrations:migrate"/>
    </exec>
</target>
.

Doctrine Migrateコマンドは、問題を求めて、実行前に[はい]または[いいえ回答]を期待しています。だから私のビルドは失敗しました:

richard@richard-desktop:~/projects/myproject$ ant migrate
Buildfile: /home/richard/projects/myproject/build.xml

migrate:
     [exec]                                                            
     [exec]                     Doctrine Migrations                    
     [exec]                                                            
     [exec] 
     [exec] 
     [exec] 
     [exec]                       
     [exec]   [RuntimeException]  
     [exec]   Aborted             
     [exec]                       
     [exec] 
     [exec] 
     [exec] migrations:migrate [--write-sql] [--dry-run] [--configuration[="..."]] [--db-configuration[="..."]] [version]
     [exec] 
     [exec] 
     [exec] WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)

BUILD FAILED
/home/richard/projects/myproject/build.xml:42: exec returned: 1

Total time: 0 seconds
richard@richard-desktop:~/projects/myproject$ 
.

どのようにしてAntを自動的にその質問に答えることができますので、移行を実行しますか?

役に立ちましたか?

解決

実際には非常に簡単でした:

<target name="migrate" description="Migrate the database">
    <exec executable="${basedir}/vendor/bin/doctrine-module" failonerror="true">
        <arg line="migrations:migrate --no-interaction"/>
    </exec>
</target>
.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top