Category : sequelize.js

Boa tarde. Escrevi o model da tabela do MYSQL em questão, que possui essa coluna "avg_ratings", exatamente como está escrito, porém o Sequelize acusa erro dizendo que a coluna não é contada na lista de campos. Adicionei um log que me retorna o SELECT gerado, e segue abaixo o mesmo: SELECT […outros campos] `ratings_votes` AS ..

Read more

I’m trying to pass this controller to a different controller to avoid clutter and lengthy code. const { Prjt_source_percent_each, Prjt_source_percent_total, Prjt_plant_each, Prjt_savings_by_comm, Prjt_plant_total, Prjt_savings_fr_fb_totals, Prjt_misc_savings_by_entity, Prjt_financial_analysis } = require("../models"); module.exports = { getData: async (req, res, project_id) => { try { const chw = await Prjt_source_percent_each.findAll({ where: { project_id, commodity: ‘CHW’, phase: ‘mv’ } }); ..

Read more

i have tables "Trades" and "Users" so user can have multiple trades. user can be buyer or seller. i am trying to define this in sequelize like this in trades Trades.associate = models => { Trades.belongsTo(models.UserData, { targetKey: ‘customId’, as: ‘buyer’, foreignKey: ‘buyerId’ }) Trades.belongsTo(models.UserData, { targetKey: ‘customId’, as: ‘seller’, foreignKey: ‘sellerId’ }) } and ..

Read more

I’m trying to query multiple rows from one table in my database at once to extract a data value based on some parameters. Like this const ele = await Prjt_source_percent_each.findOne({ where: { project_id, commodity: ‘ELE’, phase: ‘predicted’ } }); const stm = await Prjt_source_percent_each.findOne({ where: { project_id, commodity: ‘STM’, phase: ‘predicted’ } }); const hhw ..

Read more

My program just grabs ~70 pages of 1000 auctions from an API and bulk-inserts it into a SQLite database using Sequelize. I’m not sure why, but after a few times it does it, the memory usage goes up and then eventually crashes the program with this error: FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation ..

Read more