We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Postgres default schema

How to set the default schema of postgres?

Looks like the Phalcon always defines the public schema:

'database' => array(
         'adapter'        => 'Postgres',
         'host'             => 'localhost',
         'username'     => 'user',
         'password'         => 'password',
         'dbname'           => 'mydb',
         'schema'           => 'mySchema', // doesn't work <---  ERROR HERE
),

But my schema is not "public"

My problem is how to set postgres in a different schema "public"



98.9k

If 'schema' is defined, it changes the current schema in the connection to that value: https://github.com/phalcon/cphalcon/blob/1.3.3/ext/db/adapter/pdo/postgresql.c#L144-L148

If 'schema' is defined, it changes the current schema in the connection to that value: https://github.com/phalcon/cphalcon/blob/1.3.3/ext/db/adapter/pdo/postgresql.c#L144-L148

but not working

not working!!!



162

Same here not working

edited Dec '14

Temporary solution. Define in all models

public function initialize(){

$this->getModelsManager()->setModelSchema($this, 'YourSchemaName');

/*...*/

}