How do I specify which schema to use for Doctrine 2.2 / Symfony 2.2 and PostgreSQL?

前端 未结 1 1758
轮回少年
轮回少年 2020-12-19 11:15

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/cons

相关标签:
1条回答
  • 2020-12-19 11:42

    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 
    {
        // ...
    }
    
    0 讨论(0)
提交回复
热议问题