Ask your Symfony questions! Pay money and get answers fast! (more info)

examples of listing 2 databases in one schema.yml file Symfony

  • SOLVED

Can someone please post an example of listing 2 databases in one schema.yml? Thanks much. I'm looking for the right syntaxt/indentation.

Answers (2)

2010-05-12

Arturo Linares answers:

This databases.yml has 2 postgres connections

<strong>databases.yml</strong>

all:
propel:
class: sfPropelDatabase
param:
dsn: pgsql://user:[email protected]/dbname
extra:
class: sfPropelDatabase
param:
dsn: pgsql://another_user:[email protected]/extra_db
encoding: utf8 # Default charset for table creation
persistent: false # Use persistent connections



In the schema, the parent of your tables should be the name of the connection.

<strong>schema.yml</strong>

# this is for the first database
propel:
customer:
id:
name: varchar
last_name: varchar

# this is for another database
extra:
account:
id:
username: varchar
created_at

2010-05-12

michalg answers:

databases.yml

database1:
class: sfDoctrineDatabase
param:
dsn: pgsql:host=localhost;dbname=database1
username: michal
password:

database2:
class: sfDoctrineDatabase
param:
dsn: pgsql:host=localhost;dbname=database2
username: michal
password:


schema.yml

Test1:
connection: database1
columns:
number: { type: string(30), notnull: true }

Test2:
connection: database2
columns:
number: { type: string(30), notnull: true }