Modelos
const User = sequelize.define('users', {
name: {
type: Sequelize.STRING,
allowNull: false,
unique: true,
validate: {
len: [2, 40]
},
},
email: {
type: Sequelize.STRING,
allowNull: false,
validate: {
isEmail: true
},
},
password: {
type: Sequelize.STRING,
allowNull: false,
validate: {
is: /^[a-zA-Z0-9_.-]*$/i,
len: [2, 20]
},
}
}, {
freezeTableName: true // Model tableName will be the same as the model name
});