JSPM

@open-fidias/marv-better-sqlite3-driver

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q47668F
  • License MIT

A sqlite marv driver implementation using better-sqlite3

Package Exports

  • @open-fidias/marv-better-sqlite3-driver

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@open-fidias/marv-better-sqlite3-driver) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

marv-better-sqlite3-driver

A sqlite driver for marv using better-sqlite3.

Travis (.org)  npm (scoped)

Install

npm install --save marv @open-fidias/marv-better-sqlite3-driver

Usage

migrations/
  |- 001.create-table.sql
  |- 002.create-another-table.sql
const marv = require('marv')
const sqliteDriver = require('@open-fidias/marv-better-sqlite3-driver')
const directory = path.join(process.cwd(), 'migrations' )
const driver = sqliteDriver({
    table: 'db_migrations',     // defaults to 'migrations'
    connection: {
        path: 'app.sqlite',
        options: {
            memory: false,
            fileMustExist: false,
            timeout: 5000,
            verbose: null // function or null
        } // See https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/api.md#new-databasepath-options
    }
})
marv.scan(directory, (err, migrations) => {
    if (err) throw err
    marv.migrate(migrations, driver, (err) => {
        if (err) throw err
    })
})

Attach Databases

const driver = sqliteDriver({
    connection: {
        path: 'app.sqlite',
        databases: [
            {
                path: 'aux.sqlite',
                as: 'aux'
            }
        ]
    }
})

Testing

npm install # or yarn
npm test