1.1.4 • Published 7 months ago

dbm v1.1.4

Weekly downloads
4
License
-
Repository
-
Last release
7 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

7 months ago

1.1.3

7 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.1.0

8 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago

0.1.0

9 years ago