Skip to content

Instantly share code, notes, and snippets.

@natmegs natmegs/user.js
Created May 1, 2018

Embed
What would you like to do?
Define User model (in models folder)
module.exports = function(sequelize, Sequelize) {
const User = sequelize.define('user', {
id: {
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
firstname: {
type: Sequelize.STRING,
notEmpty: true
},
lastname: {
type: Sequelize.STRING,
notEmpty: true
},
email: {
type: Sequelize.STRING,
unique: true,
notEmpty: true,
validate: {
isEmail: true
}
},
password: {
type: Sequelize.STRING,
allowNull: false
},
});
return User;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.