I need to set environment specific table 开发者_StackOverflow社区prefixes, so i found unperfect solution in inserting this in ProjectConfiguration::configureDoctrine(Doctrine_Manager $manager): (config/ProjectConfiguration.class.php)
if (sfConfig::get('app_database_table_prefix')) {
$manager->setAttribute(Doctrine_Core::ATTR_TBLNAME_FORMAT,
sfConfig::get('app_database_table_prefix'));
}
... and then i can set env-unique prefixes in app.yml:
prod:
database_table_prefix: prefix__%s
BUT.. this is cool for all app, except plugins. Plugins ignores config/ProjectConfiguration.class.php.
Dont you know about alglobal solution WITHOUT changing anything in plugins directory (i need something what will influent all posible future applications plugins too)
It looks like you're using Doctrine, so it looks like you can set the prefix in your databases.yml
file. The instructions are at the bottom of this page, but it looks like you can set the table name format by adding the tblname_format to the attributes in databases.yml like so:
all:
doctrine:
param:
attributes:
tblname_format: YOURPREFIX_%s
精彩评论