Hi!..
I am trying to work with postgres schemes. Codeigniter is supported but Grocery Crud is broken by using other scheme than the public. Anyone knows anything about it? Thank you!!!
⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠
Posted 26 August 2019 - 15:31 PM
Hi!..
I am trying to work with postgres schemes. Codeigniter is supported but Grocery Crud is broken by using other scheme than the public. Anyone knows anything about it? Thank you!!!
Posted 28 August 2019 - 12:28 PM
Hi!..
I am trying to work with postgres schemes. Codeigniter is supported but Grocery Crud is broken by using other scheme than the public. Anyone knows anything about it? Thank you!!!
Hello @Cyn,
You should need to manually add the correct driver for Postgre. More specifically:
return [ 'adapter' => [ 'driver' => 'Pdo_Pgsql', 'database' => 'postgres', 'username' => 'postgres', 'password' => '', 'charset' => 'utf8' ] ];
More specifically at Codeigniter with the current installation here you should change the function in your controller like this:
private function _getDbData() { $db = []; include(APPPATH . 'config/database.php'); return [ 'adapter' => [ 'driver' => 'Pdo_Pgsql', 'host' => $db['default']['hostname'], 'database' => $db['default']['database'], 'username' => $db['default']['username'], 'password' => $db['default']['password'], 'charset' => 'utf8' ] ]; }
and it will work for you.
Let me know if that worked for you.
Regards
Johnny
Posted 28 August 2019 - 19:54 PM
Thank you John!
The change didn't work for me but this patch did work:
private function _getDbData() { $db = []; include(APPPATH . 'config/database.php'); $this->db->query("set search_path = partes,public;"); // --> "partes" is the new schema return [ 'adapter' => [ 'driver' => 'Pgsql', 'host' => $db['default']['hostname'], 'database' => $db['default']['database'], 'username' => $db['default']['username'], 'password' => $db['default']['password'], 'charset' => 'utf8' ] ];
It is not so elegant but it works. Regards!