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

Invalid connection option "adapter" with Postgresql

When connecting to Postgresql, using option "adapter" in my config, I get the error:

SQLSTATE[08006] [7] invalid connection option "adapter"

I easily resolved this by simply removing that parameter altogether. But now I'm starting to use Webtools, and so having removed the "adapter" part, webtools tries to connect to Mysql instead (and does so succefully, as I have a database with the same credentials there). So I try and add:

'adapter' => 'Postgresql',

This makes webtools connect successfully to Postgresql, producing a list of my Postgresql tables in the migrations dropdown-menu. But of course, the error re-emerges in my app. Needless to say, I would like to have this to work both in my app and in webtools with the same setting, preffereably by using the "adapter" parameter. If webtools can make this work, so should I.

What am I doing wrong?

I also found this very old issue (#58) that describes this error, but marks it as fixed:

https://github.com/phalcon/phalcon-devtools/issues/58

If it helps any, I'm using only the PDO:

use Phalcon\Db\Adapter\Pdo\Postgresql as DbAdapter;

$di->set('db', function () use ($config) {
return new DbAdapter($config->database->toArray());
});


1.2k
edited Aug '15

I might also add that webtools doesn't use the schema specified in config, instead it only reads default schema. And when creating a migration, I only get a new, empty folder with the version-number. This would be a bug, right?



1.2k
edited Aug '15

If using "adapter" option in config, and changing column data types to supported ones (i noticed this was just fixed in upcoming version), then atleast in CLI i can successfully make a migration. But if I make two migrations in a row, they produce exactly the same file, rather than just appending the changes. Shouldn't the second file add zero changes if I haven't changed anything in the database?

And then I try to run the migration in CLI. When doing this, phalcon tries to use the database name as schema name, producing this error:

Error: SQLSTATE[3F000]: Invalid schema name: 7 ERROR: schema "mydb" does not exist

Seems to me it's reusing code from doing this for Mysql, without making nescecary adjustments.