How does Propel determine which database to use for command-line tools?
Question
How does Propel determine which database to use for command-line tools (ex. "propel:build-all")? I'm setting up two environments (production and staging), and the databases will be different for each.
Is it "propel.ini" or "databases.yml"? If the former, does symfony auto-generate that file?
I would greatly appreciate any help. Thank you!
Solution 2
You can specify which environment to use in the Propel tasks (and many other tasks) by using the env
argument:
./symfony propel:build-all-load --env=staging
OTHER TIPS
You can switch database engine on command line:
This will generate the code for MySQL
symfony propel:build-all --phing-arg="Dpropel.database=mysql"
while this will generate the code for PostgreSQL
symfony propel:build-all --phing-arg="Dpropel.database=pgsql"
If you are using multiple databases you define main one in propel.ini
and you define the other ones in databases.yml
.
I'm not sure if you can generate propel.ini
but you can download example one from here