marv-pg-driver
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/marv-pg-driver package

5.0.0 • Public • Published

NPM version NPM downloads Build Status Maintainability Test Coverage Code Style

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

Package Sidebar

Install

npm i marv-pg-driver

Weekly Downloads

1,038

Version

5.0.0

License

ISC

Unpacked Size

20.3 kB

Total Files

30

Last publish

Collaborators

  • cressie176
  • ulisesgascon
  • feliun
  • guidesmiths_bot