Created
May 1, 2018 23:15
-
-
Save natmegs/38b32b8e0defe9975d8f99ff5814f6d8 to your computer and use it in GitHub Desktop.
Define User model (in models folder)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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