Use phinx migration & multi-db doctrine

remotes/origin/master
Thomas Metois 2016-06-02 11:04:52 +02:00
parent 7b6cb9a03d
commit 4f8f47ed34
3 changed files with 89 additions and 4 deletions

View File

@ -11,7 +11,8 @@
"php": ">=5.5", "php": ">=5.5",
"zendframework/zendframework": "2.5.3", "zendframework/zendframework": "2.5.3",
"doctrine/doctrine-orm-module": "^0.10", "doctrine/doctrine-orm-module": "^0.10",
"doctrine/migrations": "^1.4" "doctrine/migrations": "^1.4",
"robmorgan/phinx": "0.5.*"
}, },
"repositories":[ "repositories":[
{ {

View File

@ -11,6 +11,7 @@
* file. * file.
*/ */
return array( return array(
// DOCTRINE CONF
'doctrine' => array( 'doctrine' => array(
'connection' => array( 'connection' => array(
'orm_default' => array( 'orm_default' => array(
@ -20,7 +21,21 @@ return array(
'port' => 3306, 'port' => 3306,
'user' => 'user', 'user' => 'user',
'password' => 'password', 'password' => 'password',
'dbname' => 'monarc', 'dbname' => 'monarc_common',
'charset' => 'utf8',
'driverOptions' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
),
),
),
'orm_cli' => array(
'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => array(
'host' => 'localhost',
'port' => 3306,
'user' => 'root',
'password' => 'password',
'dbname' => 'monarc_cli',
'charset' => 'utf8', 'charset' => 'utf8',
'driverOptions' => array( 'driverOptions' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
@ -28,13 +43,62 @@ return array(
), ),
), ),
), ),
'migrations_configuration' => array( /*'migrations_configuration' => array(
'orm_default' => array( 'orm_default' => array(
'name' => 'Monarc Migrations', 'name' => 'Monarc Migrations',
'directory' => __DIR__."/../../migrations", 'directory' => __DIR__."/../../migrations",
'namespace' => 'Monarc\Migrations', 'namespace' => 'Monarc\Migrations',
'table_name' => 'doctrine_migrations', 'table' => 'migrations',
'column' => 'version',
),
'orm_cli' => array(
'name' => 'Monarc Common Migrations',
'directory' => __DIR__."/../../migrations",
'namespace' => 'MonarcCli\Migrations',
'table' => 'migrations',
'column' => 'version',
),
),*/
'entitymanager' => array(
'orm_default' => array(
'connection' => 'orm_default',
'configuration' => 'orm_default'
),
'orm_cli' => array(
'connection' => 'orm_cli',
'configuration' => 'orm_cli',
),
),
'configuration' => array(
'orm_default' => array(
'metadata_cache' => 'array',
'query_cache' => 'array',
'result_cache' => 'array',
'driver' => 'orm_default', // This driver will be defined later
'generate_proxies' => true,
'proxy_dir' => 'data/DoctrineORMModule/Proxy',
'proxy_namespace' => 'DoctrineORMModule\Proxy',
'filters' => array(),
'datetime_functions' => array(),
'string_functions' => array(),
'numeric_functions' => array(),
'second_level_cache' => array(),
),
'orm_cli' => array(
'metadata_cache' => 'array',
'query_cache' => 'array',
'result_cache' => 'array',
'driver' => 'orm_cli', // This driver will be defined later
'generate_proxies' => true,
'proxy_dir' => 'data/DoctrineORMModule/Proxy',
'proxy_namespace' => 'DoctrineORMModule\Proxy',
'filters' => array(),
'datetime_functions' => array(),
'string_functions' => array(),
'numeric_functions' => array(),
'second_level_cache' => array(),
), ),
), ),
), ),
// END DOCTRINE CONF
); );

View File

@ -12,4 +12,24 @@
*/ */
return array( return array(
'doctrine' => array(
'connection' => array(
'orm_default' => array(
'params' => array(
'host' => 'localhost',
'user' => 'root',
'password' => 'password',
'dbname' => 'monarc_common',
),
),
'orm_cli' => array(
'params' => array(
'host' => 'localhost',
'user' => 'root',
'password' => 'password',
'dbname' => 'monarc_cli',
),
),
),
),
); );