SeaseLize V5では、Models間の関連付けを設定すると、このようなエラーが発生しました。
/home/aditya/project/apisrv/node_modules/sequelize/lib/associations/base.js:106
throw new AssociationError(`You have used the alias ${options.as} in two separate associations. ` +
^
SequelizeAssociationError: You have used the alias originMenu in two separate associations. Aliased associations must have unique aliases.
at new Association (/home/aditya/project/apisrv/node_modules/sequelize/lib/associations/base.js:106:13)
at new BelongsTo (/home/aditya/project/apisrv/node_modules/sequelize/lib/associations/belongs-to.js:18:5)
at Function.<anonymous> (/home/aditya/project/apisrv/node_modules/sequelize/lib/associations/mixin.js:105:25)
at Function.Model.(anonymous function) [as belongsTo] (/home/aditya/project/apisrv/node_modules/sequelize-TypeScript/dist/model/model/model.js:116:28)
at associations.forEach.association (/home/aditya/project/apisrv/node_modules/sequelize-TypeScript/dist/sequelize/sequelize/sequelize.js:54:52)
at Array.forEach (<anonymous>)
at models.forEach.model (/home/aditya/project/apisrv/node_modules/sequelize-TypeScript/dist/sequelize/sequelize/sequelize.js:48:26)
at Array.forEach (<anonymous>)
at Sequelize.associateModels (/home/aditya/project/apisrv/node_modules/sequelize-TypeScript/dist/sequelize/sequelize/sequelize.js:44:16)
at Sequelize.addModels (/home/aditya/project/apisrv/node_modules/sequelize-TypeScript/dist/sequelize/sequelize/sequelize.js:36:14)
at Object.<anonymous> (/home/aditya/project/apisrv/src/repositories/pg/index.ts:44:15)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Module.m._compile (/home/aditya/project/apisrv/node_modules/ts-node/src/index.ts:473:23)
at Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Object.require.extensions.(anonymous function) [as .ts] (/home/aditya/project/apisrv/node_modules/ts-node/src/index.ts:476:12)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/home/aditya/project/apisrv/src/controllers/UserController.ts:7:1)
at Module._compile (internal/modules/cjs/loader.js:688:30)
_
私は言及されているものと同じエイリアス名を使用している他のモデルがないことを複数回チェックしています( 'originmenu')
PS
SeaseLize V5を使用しています TypeScript Decorator
問題を解決するのは、SeaseLizeの初期設定でモデルを2回登録するためです。だから二重化モデルを削除するモデルは私にとってコアの問題を修正します。