Skip to content

Instantly share code, notes, and snippets.

@natmegs
Created May 1, 2018 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natmegs/38b32b8e0defe9975d8f99ff5814f6d8 to your computer and use it in GitHub Desktop.
Save natmegs/38b32b8e0defe9975d8f99ff5814f6d8 to your computer and use it in GitHub Desktop.
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