Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

marv-pg-driver

4.0.0 • Public • Published

NPM version NPM downloads Build Status Maintainability Test Coverage Code Style Dependency Status devDependencies Status

marv-pg-driver

A postgres driver for marv

Usage

migrations/
  |- 001.create-table.sql
  |- 002.create-another-table.sql

Promises

const marv = require('marv/api/promise'); // <-- Promise API
const driver = require('marv-pg-driver');
const directory = path.resolve('migrations');
const connection = {
  // Properties are passed straight pg.Client
  host: 'postgres.example.com',
};
 
const migrations = await marv.scan(directory);
await marv.migrate(migrations, driver({ connection });
// Profit :)

Callbacks

const marv = require('marv/api/callback'); // <-- Callback API
const driver = require('marv-pg-driver');
const directory = path.resolve('migrations');
const connection = {
  // Properties are passed straight pg.Client
  host: 'postgres.example.com',
};
 
marv.scan(directory, (err, migrations) => {
  if (err) throw err
  // Connection properties are passed straight pg.Client
  marv.migrate(migrations, driver({ connection }), (err) => {
    if (err) throw err
    // Profit :)
  })
})

Testing

npm install
npm run docker
npm test

Install

npm i marv-pg-driver

DownloadsWeekly Downloads

395

Version

4.0.0

License

ISC

Unpacked Size

18.1 kB

Total Files

26

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar