How to use the define function from sequelize

Find comprehensive JavaScript sequelize.define code examples handpicked from public code repositorys.

40
41
42
43
44
45
46
47
48
49
var spaces = '  ';

_.forEach(jsonObj,function(key,val){
  test[val] = "/* mytestfile */\n\n";
  test[val] += "module.exports = function(sequelize, DataTypes) {\n";
  test[val] += spaces + "return sequelize.define('" + val + "', { \n";
  var fields = Object.keys(key.properties);
  fields.forEach(function(field, i){
    test[val] += spaces + spaces + field + ": {\n";
    var fieldAttr = Object.keys(key.properties[field]);
fork icon0
star icon0
watch icon1