I have a model named ManufacturerGuideline
which is nested at the 4th level. When I try to fetch the record, its chopping of ManufacturerGuideline
keys length to 5 characters. Although the Key value stored in postgreSQL table has full length.
Routes:
router.get('/:manufacturer_id', function(req, res) {
var manufacturer_id = req.params.manufacturer_id;
models.Manufacturer.findAll({
where: {
id: manufacturer_id
},
order: [[models.ManufacturerTab, 'sequence', 'ASC']],
include: [{
model: models.ManufacturerTab,
include: [{
model: models.ManufacturerField,
include: [models.ManufacturerGuideline]
}]
}
]
}).
then(function(manufacturers) {
res.status(200).json(manufacturers);
}, function(error) {
res.status(500).send(error);
});
});
So if the column name is Manufacturer
it displays as Manuf
. This issue is only appearing with ManufacturerGuideline
table and not with the parent associated table.
I was finally able to fix the issue by specifying separate: true
while including the model in the routes.
include: [{
separate: true,
model: models.ManufacturerGuideline
}]