-
-
Save aanchirinah/ab2191334c4c3cef2ade5eac184e9a32 to your computer and use it in GitHub Desktop.
Generating User with Sequelize CLI
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, DataTypes) { | |
var User = sequelize.define('User', { | |
firstName: DataTypes.STRING, | |
lastName: DataTypes.STRING, | |
email: DataTypes.STRING, | |
password: DataTypes.STRING, | |
isVerified: DataTypes.BOOLEAN | |
}, { | |
classMethods: { | |
associate: function(models) { | |
User.hasOne(models.VerificationToken, { | |
as: 'verificationtoken', | |
foreignKey: 'userId', | |
foreignKeyConstraint: true, | |
}); | |
} | |
} | |
}); | |
return User; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment