belongsToMany issue in NodeJS"/>
Sequelize many to many belongsToMany issue in NodeJS
我正在尝试在角色和访问之间创建多对多关系。
roles
表将有一个角色列表(管理员、开发人员等...),accesses
表将有一个权限列表(创建项目、创建站点、删除项目等...)。我正在尝试建立多对多关系并创建一个联结表作为 RolePermissions。
现在我已经成功创建了所有迁移并创建了表,但是当我启动节点服务器时,我打赌 Sequelize 中的错误index.js.
我花了几个小时没能得到它,请有人建议我...提前致谢。
C:\Users\chand\Work\AssetOne\AI-app\ai-application-service\node_modules\sequelize\src\associations\belongs-to-many.js:136
this.targetKeyField = this.target.rawAttributes[this.targetKey].field || this.targetKey;
^
TypeError: Cannot read property 'field' of undefined
at new BelongsToMany (C:\Users\chand\Work\AssetOne\AI-app\ai-application-service\node_modules\sequelize\src\associations\belongs-to-many.js:136:71)
at Function.belongsToMany (C:\Users\chand\Work\AssetOne\AI-app\ai-application-service\node_modules\sequelize\src\associations\mixin.js:64:25)
at Function.associate (C:\Users\chand\Work\AssetOne\AI-app\ai-application-service\models\access-list.js:13:18)
at C:\Users\chand\Work\AssetOne\AI-app\ai-application-service\models\index.js:36:19
at Array.forEach (<anonymous>)
at Object.<anonymous> (C:\Users\chand\Work\AssetOne\AI-app\ai-application-service\models\index.js:34:17)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
回答如下:
更多推荐
Sequelize many to many belongsToMany issue in NodeJS
本文发布于:2024-05-31 01:01:27,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
发布评论