imaginar/models/user.js

38 lines
766 B
JavaScript
Raw Normal View History

2024-10-19 11:24:54 +00:00
'use strict';
module.exports = (sequelize, DataTypes) => {
const User = sequelize.define('User', {
id: {
type: DataTypes.BIGINT,
autoIncrement: true,
primaryKey: true
},
discordId: {
type: DataTypes.STRING,
allowNull: false
},
username: {
type: DataTypes.STRING,
allowNull: false
},
email: {
type: DataTypes.STRING,
allowNull: true
},
isAccountSetupComplete: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false
}
}, {
tableName: 'users',
underscored: true,
timestamps: true
});
User.associate = function(models) {
User.hasMany(models.Isotope, { foreignKey: 'user_id', onDelete: 'CASCADE' });
};
return User;
};