Last active
June 21, 2017 09:31
-
-
Save banyudu/8c28b8a6b3e0eda3108733854b13a0d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sequelize = require('sequelize') | |
const db = new sequelize('test', 'test', '', { | |
dialect: 'postgres', | |
host: '127.0.0.1', | |
port: 5432, | |
}) | |
const Foo = db.define('foo') | |
const Bar = db.define('bar') | |
Foo.belongsTo(Bar, {as: 'foo'}) | |
// as 'foo' multi times will throw exception in sequelize@4 | |
// You have used the alias foo in two separate associations. Aliased associations must have unique aliases. | |
// sequelize@3 will work as normal | |
Foo.belongsTo(Bar, {as: 'foo'}) | |
// use a new alias name will fix this issue | |
Foo.belongsTo(Bar, {as: 'another'}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment