I have a multilingual application with each language data in a separate database. This is how it’s configured in Symfony 2.2 and Propel 1.6 (excerpt from config key propel.dbal.connections):
pl_general: &GENERAL
<<: *BASEDB
dsn: mysql:host=%db_host%;dbname=%db_general%_pl%db_suffix%
general:
<<: *GENERAL
ar_general:
<<: *BASEDB
dsn: mysql:host=%db_host%;dbname=%db_general%_ar%db_suffix%
at_general:
<<: *BASEDB
dsn: mysql:host=%db_host%;dbname=%db_general%_at%db_suffix%
bg_general:
<<: *BASEDB
dsn: mysql:host=%db_host%;dbname=%db_general%_bg%db_suffix%
And so on. There is one general connection that points to my default language. All other databases have the exact same structure as my default. I have a general-schema.xml with all models configured.
The problem begins when I try to generate a diff (propel:migration:generate-diff) or execute a migration (propel:migration:migrate). Propel does not know that those connections are siblings, and anything relating to the general connection should also be executed on every LANG_general connection. Also, when doing a diff, only the default db is compared against the schema/models, so I cannot guarantee the integrity.
I would like to:
- make sure that all of the databases have the same structure
- add all new changes to a group of connections at once and without much hassle
I’m looking for a by-the-book solution, preferably using Propel own mechanisms, but I am open to all suggestions. Whatever works and is stable. Opinions, comments and proven solutions very welcome! Source code appreciated
Alter table user-- no way I could easily apply this touser_en,user_fr,user_es, etc. - Maciej Łebkowski