views:

169

answers:

2

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!

A: 

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

RaYell
Thanks for the tip RaYell. That's close to the conclusion I came to for myself, except you can actually load the database from the environment of your choice (see below). Thanks again!
James Skidmore
A: 

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
James Skidmore