https://github.com/marcbachmann/knex-umzug
https://github.com/marcbachmann/knex-umzug
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/marcbachmann/knex-umzug
- Owner: marcbachmann
- Created: 2016-07-28T19:49:54.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T20:26:16.000Z (over 2 years ago)
- Last Synced: 2025-01-03T04:50:23.772Z (over 1 year ago)
- Language: JavaScript
- Size: 179 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# knex-umzug
[](https://greenkeeper.io/)
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`.
Please check out the umzug api for more details: https://www.npmjs.com/package/umzug#api
Umzug v3:
```js
const {Umzug} = require('umzug')
const knex = require('knex')
const KnexUmzug = require('knex-umzug')
const db = require('knex')({
client: 'sqlite3',
connection: {filename: './db.sql'}
})
const umzug = new Umzug({
storage: new KnexUmzug({
// The context allows you to reuse the same migrations table
// to maintain the state for multiple isolated migration setups.
// e.g. 'upstream', 'downstream'
context: 'default',
connection: db,
tableName: 'migrations'
})
})
umzug.up().then(function (result) {
})
```
Umzug v2:
```js
const Umzug = require('umzug')
const db = require('knex')({
client: 'sqlite3',
connection: {filename: './db.sql'}
})
const umzug = new Umzug({
storage: 'knex-umzug',
storageOptions: {
// The context allows you to reuse the same migrations table
// to maintain the state for multiple isolated migration setups.
// e.g. 'upstream', 'downstream'
context: 'default',
connection: db,
tableName: 'migrations'
}
})
umzug.up().then(function (result) {
})
```