fix: seed user data column name (#87)

This commit is contained in:
Takeshi Kimata
2024-10-26 10:58:04 +09:00
committed by GitHub
parent 4dfcff6971
commit 919556c7be
3 changed files with 56 additions and 52 deletions

View File

@@ -1,32 +1,36 @@
/**
*
* @param {import('sequelize').Sequelize} sequelize
* @param {*} DataTypes
* @returns
*
* @param {import('sequelize').Sequelize} sequelize
* @param {*} DataTypes
* @returns
*/
function defineUser(sequelize, DataTypes) {
const User = sequelize.define('User', {
email: {
type: DataTypes.STRING,
allowNull: false,
unique: true,
const User = sequelize.define(
'User',
{
email: {
type: DataTypes.STRING,
allowNull: false,
unique: true,
},
password: {
type: DataTypes.STRING,
allowNull: false,
},
username: {
type: DataTypes.STRING,
allowNull: false,
},
role: {
type: DataTypes.INTEGER,
allowNull: false,
},
avatarPath: {
type: DataTypes.STRING,
},
},
password: {
type: DataTypes.STRING,
allowNull: false,
},
username: {
type: DataTypes.STRING,
allowNull: false,
},
role: {
type: DataTypes.INTEGER,
allowNull: false,
},
avatarPath: {
type: DataTypes.STRING,
},
}, { underscored: true });
{ underscored: true }
);
User.associate = (models) => {
User.hasMany(models.Project, { foreignKey: 'userId' });