user.js
996 Bytes
module.exports = (sequelize, DataTypes) => {
const User = sequelize.define("User", {
email: {
type: DataTypes.STRING(30),
allowNull: false,
unique: true
},
nickName: {
type: DataTypes.STRING(10),
allowNull: false,
unique: true
},
hashedPassword: {
type: DataTypes.STRING(200),
allowNull: false
}
}, {
timestamps: true,
paranoid: true,
underscored: false,
charset: 'utf8mb4',
collate: 'utf8mb4_general_ci'
});
// User.associate = (models) => {
// models.User.hasMany(models.SnsId, {onDelete: 'CASCADE', foreignKey: 'userId', sourceKey: 'id'});
// models.User.hasMany(models.Post, {onDelete: 'CASCADE', foreignKey: 'userId', sourceKey: 'id'});
// models.User.hasMany(models.Comment, {onDelete: 'CASCADE', foreignKey: 'userId', sourceKey: 'id'});
// };
return User;
}