-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
Labels
type: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type
Description
What are you doing?
I am specifying the singular and plural names of an alias. I then later try to include with the all: true option, but that results in a SequelizeDatabaseError of { name: 'SequelizeEagerLoadingError' }.
When I specify an as without explicit singular/plurals this issue does not arise.
Note: I think the issue is similar to what @raxod502 commented here.
let name = 'theAliasName'
// Below works with include: { all: true }
through: db.define( name, {
amount: Sequelize.FLOAT,
unit: Sequelize.STRING,
dataSource: Sequelize.STRING
} ),
as: name + 's'
} )
// Below DOES NOT work
through: db.define( name, {
amount: Sequelize.FLOAT,
unit: Sequelize.STRING,
dataSource: Sequelize.STRING
} ),
as: {
singular: name,
plural: name + 's'
}
} )Later these associations are called with:
Model.findOne( {
where: { id: relevant_id, userId: user_id },
include: [ { all: true } ]
} ) )What do you expect to happen?
I expect:
- The alias table to be populated when a relationship is set (happens in both cases, no issue)
- The
include: { all: true }to load the associated data
What is actually happening?
Sequelize throws { name: 'SequelizeEagerLoadingError' }
Dialect: postgres
Database version: 10.5
Sequelize version: 4.38.1
Tested with latest release: Yes
Edit 1: added code used to findOne
Edit 2: added error name
Metadata
Metadata
Assignees
Labels
type: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type