node package manager
Orgs are free. Discover, share, and reuse code in your team. Create a free org »




Produces static Sails / Waterline models by reverse engineering existing databases


To install this adapter, run:

$ npm install --save sails-model-reverser


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 = [
var options = {
  outputPath: '/path/for/output',
  connectionName: 'myConnection',
var reverser = new Reverser(adapter, connection, tables, options);

More Resources


MIT © 2016 balderdashy & [contributors] Mike McNeil, Balderdash & contributors

Sails is free and open-source under the MIT License.