0.2.0 • Published 5 years ago

synor v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Synor

Database Migration Library

Installation

# using yarn:
yarn add synor

# using npm:
npm install --save synor

Usage

const path = require('path')
const { Synor } = require('synor')
const { MySQLDatabaseEngine } = require('synor/lib/database/mysql')
const { FileSourceEngine } = require('synor/lib/source/file')

const synor = Synor({
  DatabaseEngine: MySQLDatabaseEngine,
  SourceEngine: FileSourceEngine,
  databaseUri: 'mysql://root:root@localhost:3306/synor',
  sourceUri: `file://${path.resolve('migrations')}`
})

const currentVersion = async () => {
  await synor.migrator.open()
  const version = await synor.migrator.version()
  console.log('version', version)
  await synor.migrator.close()
}

currentVersion().catch(err => {
  console.error(err)
  process.exit(1)
})

License

Licensed under the MIT License. Check the LICENSE file for details.