sails-model-reverser
v1.0.6
Published
Produces static Sails / Waterline models by reverse engineering existing databases
Downloads
3
Maintainers
Readme
node-sails-model-reverser
Produces static Sails / Waterline models by reverse engineering existing databases
Installation
To install this adapter, run:
$ npm install --save sails-model-reverser
Usage
An example follows which uses the Apache Derby adapter (sails-derby) to reverse engineer and create models for the TESTTABLE table of the TESTDB database (running on the standard port of localhost).
Each model is written to a single file and is placed in the path specified
by options.outputPath
(/path/for/output
in the example below). If no
output path is specified, the files will be placed in the generated
sub-directory of this module (so, probably
node_modules/sails-model-reverser/generated
).
Each model is generated to use the connection specified by
options.connectionName
(myConnection
in the example below). If no
connection name is specified, the default connection name, default
, will
be used.
At the time of this writing, sails-derby is the only tested adapter.
var Reverser = require('sails-model-reverser');
var adapter = require('sails-derby');
var connection = {
url: 'jdbc:derby://localhost:1527/TESTDB',
minpoolsize: 10,
maxpoolsize: 100,
};
var tables = [
'TESTTABLE',
];
var options = {
outputPath: '/path/for/output',
connectionName: 'myConnection',
};
var reverser = new Reverser(adapter, connection, tables, options);
reverser.reverse();
More Resources
License
MIT © 2016 balderdashy & [contributors] Mike McNeil, Balderdash & contributors
Sails is free and open-source under the MIT License.