Reverse Engineer Database with Bookshelf.JS? -
what process generating bookshelf model objects existing mysql database?
the examples on bookshelf.js site show several model objects...
var knex = require('knex')({client: 'mysql', connection: process.env.mysql_database_connection }); var bookshelf = require('bookshelf')(knex); var user = bookshelf.model.extend({ tablename: 'users', posts: function() { return this.hasmany(posts); } });
the closest knex.js site comes mentioning migrations. however, using syntax...
$ npm install -g knex $ npm install knex --save $ npm install mysql --save $ knex init $ knex migrate:make knextest
... generates 1 file empty functions ...
exports.up = function(knex, promise) { }; exports.down = function(knex, promise) { };
... makes sense, since knex not orm. guess ended here because bookshelf didn't mention tools this.
on side note, i've checked knexfile.js
, made sure has valid configuration:
development: { client: 'mysql', connection: { host : 'localhost', user : 'root', password : 'oogaboogs', database : 'knexdb' } },
is not possible? suck create thousands of model objects hand existing database.
thanks, in advance.
Comments
Post a Comment