Wednesday 15 August 2012

mysql - symfony 2.x / doctrine 2.4 app/console requires database -



mysql - symfony 2.x / doctrine 2.4 app/console requires database -

in ci environment i'm dropping db , recreating on every new build. on older projects works fine. on newer project starts failing.

when running

php app/console doctrine:database:drop --env=test --force

everything goes fine. after that, console commands, like

php app/console cache:clear

start giving error

[doctrine\dbal\exception\connectionexception] exception occured in driver: sqlstate[42000] [1049] unknown database '(my database)'

this error when trying create new database doctrine, suspect has more bootstrapping symfony when running console.

i've tested problem downgrading symfony 2.5 2.3, forcing symfony , doctrine same versions in project app/console doesn't break - no result. i' tracing mutual ground on running different commands, , suspect bootstrap.php might able provide clues might break.

$ php app/console doctrine:database:drop --force $ php app/console doctrine:database:create

there's no way configure these defaults within doctrine, tries agnostic possible in terms of environment configuration. 1 way solve problem configure server-level defaults.

setting utf8 defaults mysql simple adding few lines configuration file (typically my.cnf):

[mysqld]

collation-server = utf8_general_ci character-set-server = utf8

source: http://symfony.com/doc/current/book/doctrine.html

mysql symfony2 doctrine2

No comments:

Post a Comment