我正在尝试为具有options
列的表创建一个sequelize模型,但是当我尝试查询时遇到错误(例如,查找):
/Users/camupod/node_modules/sequelize/lib/sequelize/model.js:17
var defaults = this.options.hasPrimaryKeys ? {} : { id: null }
^
TypeError: Cannot read property 'hasPrimaryKeys' of null
at new <anonymous> (/Users/camupod/node_modules/sequelize/lib/sequelize/model.js:17:30)
at [object Object].build (/Users/camupod/node_modules/sequelize/lib/sequelize/model-definition.js:140:18)
at /Users/camupod/node_modules/sequelize/lib/sequelize/query.js:47:64
at Array.map (native)
at [object Object].onSuccess (/Users/camupod/node_modules/sequelize/lib/sequelize/query.js:47:22)
at /Users/camupod/node_modules/sequelize/lib/sequelize/query.js:22:38
at Query.<anonymous> (/Users/camupod/node_modules/mysql/lib/client.js:108:11)
at Query.emit (events.js:61:17)
at Query._handlePacket (/Users/camupod/node_modules/mysql/lib/query.js:51:14)
at Client._handlePacket (/Users/camupod/node_modules/mysql/lib/client.js:312:14)
我模型的定义:
Model.recording = sequelize.define(
'recordings',
{
/* other columns... */
options: Sequelize.TEXT
},
{
timestamps: false,
freezeTableName: true
}
);
sequelize真的不允许options
作为列名,还是我做错了什么?
答案 0 :(得分:2)
嗯,这是一个非常愚蠢的“边缘”。定义一个名为“options”的属性将覆盖模型的选项:D糟透了:(。
问题刚刚解决,修复程序在v1.1.3中可用。如果有效,请告诉我。