@heisian/sequelize-cli
Version:
The Sequelize CLI
17 lines (14 loc) • 620 B
JavaScript
module.exports = (sequelize, DataTypes) => {
var <%= name %> = sequelize.define('<%= name %>', {
<% attributes.forEach(function(attribute, index) { %>
<%= attribute.fieldName %>: DataTypes.<%= attribute.dataFunction ? `${attribute.dataFunction.toUpperCase()}(DataTypes.${attribute.dataType.toUpperCase()})` : attribute.dataType.toUpperCase() %>
<%= (Object.keys(attributes).length - 1) > index ? ',' : '' %>
<% }) %>
}, {
<%= underscored ? 'underscored: true,' : '' %>
});
<%= name %>.associate = function(models) {
// associations can be defined here
};
return <%= name %>;
};