knex-umzug

A storage adapter for umzug, a database migration module.

Usage no npm install needed!

<script type="module">
  import knexUmzug from 'https://cdn.skypack.dev/knex-umzug';
</script>

README

knex-umzug

Greenkeeper badge

A storage adapter for umzug, a database migration library.

It supports namespacing and custom database table names. This storage adapter not only shows you the current state of a migration but also shows all the migration paths and tracks hostname and system user which executed a migration.

This library only makes knex work with umzug. If you're interested in a CLI, please check out https://github.com/marcbachmann/umzug-cli.

var Umzug = require('umzug')
var db = require('knex')({
    client: 'sqlite3',
    connection: {filename: './db.sql'}
})

var umzug = new Umzug({
    storage: 'knex-umzug',
    storageOptions: {
      context: 'default',
      connection: db,
      tableName: 'migrations'
    }
})

umzug.someMethod().then(function (result) {

})

Please check out the umzug api: https://www.npmjs.com/package/umzug#api A cli that adds additional functionality will follow soon.