How to use pgtools - 2 common examples

To help you get started, we’ve selected a few pgtools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chrisdickinson / ormnomnom / test / db.js View on Github external
function createdb () {
  ormnomnom.setConnection(getConnection)
  return pgtools.dropdb({}, TEST_DB_NAME).catch(err => {
    // ignore this error since it throws if the db doesn't exist
    if (err.name !== 'invalid_catalog_name') {
      throw err
    }
  }).then(() => {
    return pgtools.createdb({}, TEST_DB_NAME)
  }).then(() => {
    return getConnection().then(client => {
      return client.query(fs.readFileSync(path.join(__dirname, 'fixture.sql'), { encoding: 'utf8' })).then(() => client.end())
    })
  })
}
github chrisdickinson / ormnomnom / test / db.js View on Github external
}).then(() => {
    return pgtools.createdb({}, TEST_DB_NAME)
  }).then(() => {
    return getConnection().then(client => {

pgtools

Pure Node.js implementation of PostgreSQL's createdb and dropdb tools

MIT
Latest version published 9 months ago

Package Health Score

64 / 100
Full package analysis

Popular pgtools functions