Push Notifications · Vapor Server | raywenderlich.com

This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1258151-push-notifications/lessons/9

Hi Audrey,

migrations.add(model: Token. **self** , database: .psql)

got Xcode error message

Reference to member ‘psql’ cannot be resolved without a contextual type


hi Mazen! according to this stack overflow answer:

you need to replace database: .psql with the explicit type, something like:

database: DatabaseIdentifier<PostgreSQLDatabase>.psql
1 Like

Thank you so much for the quick response. It is compiling now on Xcode 11.4.1
database: DatabaseIdentifier<Token.Database>.psql

1 Like

For anyone who got the following

Error message:

[PostgreSQLError.password: Password is required]


  let config = PostgreSQLDatabaseConfig(hostname: server,
                                        username: "postgres",
                                        database: "postgres",
                                        password: password)

And at the sendPushes.php file I had to add the password field accordingly:

$db = new PDO('pgsql:host=localhost;dbname=postgres;user=postgres;password=password');

1 Like

@mazen_kasser Thank you for sharing your solution - much appreciated!

Thanks for sharing your solution @mazen_kasser

How fix this error ,
connectFailed(NIO.NIOConnectionError(host: “localhost”, port: 5432, dnsAError: nil, dnsAAAAError: nil, connectionErrors: [NIO.SingleConnectionFailure(target: [IPv6]localhost:5432, error: connection reset (error set): Connection refused (errno: 61) ), NIO.SingleConnectionFailure(target: [IPv4]localhost:5432, error: connection reset (error set): Connection refused (errno: 61) )]))

this might be a Vapor version issue, so paging @0xtim

the course uses an earlier version of Vapor

@mohamedosama74 that error means it’s trying to connect to the database on localhost:5432 but there’s nothing to connect to. Did you set up the database?

1 Like