How do I specify which schema to use for Doctrine 2.2 / Symfony 2.2 and PostgreSQL?
doctrine-orm, symfony
Solution
If you're using the `public` schema, you don't have to do anything special, because PostgreSQL fallbacks to it automatically.
However, if you want to specify another schema — or enforce the usage of the `public` schema in case PostgreSQL fallbacks to another one for some reason — the `@Table` annotation has the `schema` property:
use Doctrine\ORM\Mapping\Table;
/**
* @Table(schema="some_schema")
*/
class Entity
{
// ...
}
Problem
I have the same problem as reported here: Doctrine 2.2 wants to recreate all my tables I'm using PostgreSQL and my tables are in the public schema. app/console doctrine:schema:update wants to recreate all my tables, apparently because it's looking in the user schema, not public. My Symfony application works fine as it is which seems a little strange. With Symfony 2.2 / Doctrine 2.2 where do I specify the schema? I can't seem to find it in any documentation.