38 lines
766 B
JavaScript
38 lines
766 B
JavaScript
'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;
|
|
};
|