2.0.0 • Published 2 years ago

marv-oracledb-driver v2.0.0

Weekly downloads
10
License
ISC
Repository
github
Last release
2 years ago

NPM version NPM downloads Maintainability Test Coverage Code Style

marv-oracledb-driver

An oracle database 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-oracledb-driver');
const directory = path.resolve('migrations');
const connection = {
  // Properties are passed straight oracledb.getConnection
  connectionString: 'localhost:32118/XE',
  user: 'system',
  password: 'Oracle18'
};

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-oracledb-driver');
const directory = path.resolve('migrations');
const connection = {
  // Properties are passed straight oracledb.getConnection
  connectionString: 'localhost:32118/XE',
  user: 'system',
  password: 'Oracle18',
};

marv.scan(directory, (err, migrations) => {
  if (err) throw err;
  marv.migrate(migrations, driver({ connection }), (err) => {
    if (err) throw err;
    // Profit :)
  });
});

Testing

npm install
npm test

Tests run inside a docker container that contains the oracle client libraries, and against an Oracle XE instance which is also in a container. Both are managed by docker-compose and launched by running npm test, however it the database does take a while to start, so tests may fail initially.