1.1.4 • Published 3 months ago

dbm v1.1.4

Weekly downloads
4
License
-
Repository
-
Last release
3 months ago

DBM

Data Base Manager - built on top of KnexJs, provides utility db management tools.

Migrator

Migration based on app versions. Inspired by knex-migrator from Ghost

Usage
const dbm = require('dbm')

const migrator = new dbm.Migrator({
  path: path.join(process.cwd(), 'data/migrations'),
  version: '1.3.0', 
  database: { // knex connection config
    client: 'sqlite3',
    connection: {
      filename: 'data/test.db'
    }
  }
})

migrator.connect() // connect to database
    .then(() => migrator.init()) // initialize migration
    .then(() => migrator.migrate()) // run migrations up to version 1.3.0
    .finally(() => migrator.disconnect()) // disconnect
Folder Structure
    data
    |-- migrations
    |----- init
    |-------- 1-create-tables.js
    |----- 1.0.0
    |-------- 1-modify-user-columns.js
    |----- 1.2.0
    |-------- 1-drop-refer-column.js
API

migrator.connect()

migrator.ready()

migrator.init()

migrator.analyse()

migrator.migrate()

migrator.migrateTo()

migrator.disconnect()

Exporter

WIP

1.1.4

3 months ago

1.1.3

3 months ago

1.1.2

4 months ago

1.1.1

4 months ago

1.1.0

4 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

7 months ago

1.0.0

7 months ago

0.1.0

9 years ago