-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
Description
I have a model defined as:
sequelize.define('referral', {
status: {
type: DataTypes.ENUM('OPENED', 'INTERESTED'),
allowNull: false,
defaultValue: null
},
maxReferrals: {
field: 'max_referrals',
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null
},
properties: {
type: DataTypes.JSON,
allowNull: true,
defaultValue: null
},
reward: {
type: DataTypes.NUMERIC,
allowNull: true,
defaultValue: null
},
broken: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false
}
}, {tableName: 'referral', underscored: true, underscoredAll: true});
Later on:
Referral.belongsTo(Referral, {foreignKey: 'referral_id', as: 'referral', constraints: false});
Basically, every referral has referral_id that references another referral. I can see the referral_id field in my result, but I am missing the expanded referral object that the referral references.
I am calling .findAll({ includes: [{all: true, nested: true}]}) so I believe that data should be there. Any thoughts?
All of the other expands work.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels