-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed as not planned
Description
when executing connect()
it fails if the database doesn't exist.
there are two solutions:
- either to add an option to create the missing database
- or, just establish the connection without selecting a database
connect({createDb: true, host: 'localhost', ...config})
or
connect(config)
.catch(err=>{
if(/* error caused by a missing database */)
pg.query(`CREATE DATABASE ${db}`)
.then(()=>connect())
}
Metadata
Metadata
Assignees
Labels
No labels