module.exports = (sequelize, DataTypes) => {
var Student = sequelize.define('Student', {
residence: DataTypes.ARRAY(DataTypes.STRING),
},
{
classMethods: {
associate: function (models) {
// associations can be defined here
}
},
underscored: true
});
return Student;
};
throw error:
/Users/xjnotxj/Program/NodeJsProject/sequelize_demo/backend/models/student.js:25
residence: DataTypes.ARRAY(DataTypes.STRING),
^
TypeError: DataTypes.ARRAY is not a function
at module.exports (/Users/xjnotxj/Program/NodeJsProject/sequelize_demo/backend/models/student.js:25:30)
at new JoiSequelize (/Users/xjnotxj/Program/NodeJsProject/sequelize_demo/backend/node_modules/joi-sequelize/index.js:14:3)
at fs.readdirSync.filter.forEach.file (/Users/xjnotxj/Program/NodeJsProject/sequelize_demo/backend/models/index.js:29:25)
at Array.forEach (<anonymous>)
at Object.<anonymous> (/Users/xjnotxj/Program/NodeJsProject/sequelize_demo/backend/models/index.js:25:4)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/xjnotxj/Program/NodeJsProject/sequelize_demo/backend/middleware/valication.js:3:16)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/xjnotxj/Program/NodeJsProject/sequelize_demo/backend/app.js:23:9)
at Module._compile (module.js:635:30)
model define
:throw error: