0.2.3 • Published 8 years ago

dbconvert v0.2.3

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

Note: DB Convert is currently under development and not ready for productional use!

DB Convert

Coverage Status Build Status Code Climate Dependency Status devDependency
Status

DB Convert helps to transfer one database to a different type of database, for example a MySQL database to a MongoDB. DB Convert allows to run a full conversion with relation building or just the single steps. DB Convert also have a rollback functionality. Usable as command line tool or in your code.

Available via NPM

  • npm install -g dbconvert

Quick Example

Bash with DB Convert as global package with config.json in same directory

dbconvert con

In your project

var DbConvert = require('dbconvert');
var config = {
  //your config goes here
};

var dbc = new DbConvert().load(config);
dbc.convert();

Usage

To run DB Convert you need at least to configure the toHost and the fromHost. This can be done in a config.json in the directory you want to run DB Convert or you insert the path to the file in the --config argument. If you want to remap your tables/collections or columns/fields you need a mapping.js with all the mapping information. Same thing for relations. Examples of the files can be found in the example folder.

Convert

dbconvert con [options] || dbconvert convert [options]

convert options

-h, --help                                           output usage information
--sync                                               Run migration in synchrone mode.
--table [table]                                      Run migration for a single table.
--drop                                               Drop collections/tables if they exist on destination host.
--quiet                                              No output except of errors.
--log [level]                                        Define a log level [level].
--logPath [path]                                     Specify a log path (default: cwd).
--fromHost [[protocol://][user:password@]host:port/database]  Connection string for the host to migrate from.
--toHost [[protocol://][user:password@]host:port/database]    Connection string for the host to migrate to.
--config [path]                                      path to your config.json
--mapping [path]                                     path to your mapping.js
--relation [path]                                    path to your relation.js

Migrate

dbconvert mig [options] || dbconvert migrate [options]

migrate options

-h, --help                                           output usage information
--sync                                               Run migration in synchrone mode.
--table [table]                                      Run migration for a single table.
--drop                                               Drop collections/tables if they exist.
--quiet                                              No output except of errors.
--log [level]                                        Define a log level [level].
--logPath [path]                                     Specify a log path (default: cwd).
--fromHost [[protocol://][user:password@]host:port/database]  Connection string for the host to migrate from.
--toHost [[protocol://][user:password@]host:porthost:port/database]                 Connection string for the host to migrate to.
--config [path]                                      path to your config.json

Relations

dbconvert rel [options] || dbconvert relation [options]

relation options

-h, --help                                         output usage information
--sync                                             Run migration in synchrone mode.
--table [table]                                    Run migration for a single table.
--quiet                                            No output except of errors.
--log [level]                                      Define a log level [level].
--logPath [path]                                   Specify a log path (default: cwd).
--toHost [[protocol://][user:password@]host:port/database]  Connection string for the host to migrate to.
--config [path]                                    path to your config.json

Rollback

dbconvert rb [options] || dbconvert rollback [options]

rollback options

-h, --help                                                    output usage information
--table [table]                                               Run migration for a single table.
--quiet                                                       No output except of errors.
--log [level]                                                 Define a log level [level].
--logPath [path]                                              Specify a log path (default: cwd).
--toHost [[protocol://][user:password@]host:port/database]    Connection string for the host to migrate to.
--config [path]                                               path to your config.json

To show the help text

dbconvert help

License

MIT License Copyright © 2016 Dominic Rico-Gomez

forthebadge