0.0.8 • Published 8 years ago

node-mig v0.0.8

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

node-mig

DB agnostic migrations module for node.js.

Honorable mention goes to https://github.com/rickbergfalk/postgrator for inspiration for this project. Though this is not a fork of his project, I used many of his conventions in the documentation, configuration, etc.

Usage

Migration scripts should be named with the convention "version.action.description.sql".

version must be numeric.

action must be either "do" or "undo". Undo is not yet supported.

description is a brief description of what the file does. It should not contain periods nor apostrophes.

Database

The database processor is provided to node-mig during initialization. I have provided a sample processor for mssql, though the actual db connection is managed by you.

Here is sample code that connects to a mssql database (using the mssql module) and migrates that database up to the latest version:

var sql = require("mssql");

sql.connect(myDBConfigOptions).then(function() {
    var migrator = require("node-mig");
    var processor = migrator.mssql(sql);

    migrator.migrate(
        { migrationsFolder: path.join(__dirname, "migrations") },
        processor,
        warnOnError
    );
}).catch(warnOnError);
0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago