Postgres in Concrete 5.7

Permalink
Hi,

Has anyone had any luck with running Concrete 5.7 on Postgres?
In that case, any pointers on what you have to do to make it work?

Thanks,

Henrik

henpe
View Replies:
titanve replied on at Permalink Reply
titanve
Hello Henpe,

Do you know what is the driver for Postgres? like c5_pdo_mysql?

Thank you.
titanve replied on at Permalink Reply
titanve
Hello Henpe,

Do you know what is the driver for Postgres? like c5_pdo_mysql?

Thank you.
exchangecore replied on at Permalink Reply
exchangecore
Just guessing here but you're probably going to have a heck of a time getting this to work. With concrete5 version 7 concrete5 *started* implementing doctrine DBAL / ORM in it's code. However, there is still a lot of legacy stuff out there that was written the the complete idea that MySQL was the only database in mind. There are numerous function calls that happen database side that might not be compatible with all RDBMS's and that's not even talking about marketplace packages that probably didn't think about trying to support a different database. Also, concrete5 as you can see from the driver name uses an extended driver which has functions to support some backwards compatibility stuff from the pre-57 days.

At this point in time I'd say, theoretically you could probably get pretty close to being able to implement a "roll your own" postgres driver class if it had the backwards compatibility things written. But even with that you'd likely have to modify the core files as you came across problems to fix database calls that might be using mysql specific functions.
titanve replied on at Permalink Reply
titanve
What if I want to maintain the C5 core functions with mysql and just my app with postgresql?
exchangecore replied on at Permalink Reply
exchangecore
Oh sure you could do that.

To connect to an existing postgres database you would do end up having something like this in your application/config/database.php file:

'concrete' => array(
            'driver' => 'c5_pdo_mysql',
            'server' => 'localhost',
            'database' => 'c5dev',
            'username' => 'root',
            'password' => 'mypassword',
            'charset' => 'utf8'
        ),
        'mypostgresdb' => array(
            'driver' => 'pdo_pgsql',
            'server' => 'localhost',
            'database' => 'postgresDatabaseName',
            'username' => 'root',
            'password' => 'mypassword',
        ),


and then to get at that database you would do something like this is concrete5:

$db = \Database::connection('mypostgresdb');
$users = $db->fetchAll('SELECT * FROM postgresTableUsers');


or something to that effect. You can check out the doctrine documentation (http://doctrine-dbal.readthedocs.org/en/latest/reference/data-retri... ) for more pointers, but that's pretty much how you would set up the connection.
titanve replied on at Permalink Reply
titanve
THANK YOU SO MUCH!

Have a great night!