I'm new here !
I'm trying to do a query on a MS SQL Server2008 with sequelize, but I get this error:
Unhandled rejection SequelizeDatabaseError: Invalid column name 'id'. at Query.formatError (C:\xampp\htdocs\Lavori\Bit_Sense\API_BS\node_modules\s equelize\lib\dialects\mssql\query.js:217:10) at Request.userCallback (C:\xampp\htdocs\Lavori\Bit_Sense\API_BS\node_module s\sequelize\lib\dialects\mssql\query.js:66:25) at Request.callback (C:\xampp\htdocs\Lavori\Bit_Sense\API_BS\node_modules\te dious\lib\request.js:30:27) at Connection.STATE.SENT_CLIENT_REQUEST.events.message (C:\xampp\htdocs\Lavo ri\Bit_Sense\API_BS\node_modules\tedious\lib\connection.js:283:29) at Connection.dispatchEvent (C:\xampp\htdocs\Lavori\Bit_Sense\API_BS\node_mo dules\tedious\lib\connection.js:752:59) at MessageIO. (C:\xampp\htdocs\Lavori\Bit_Sense\API_BS\node_modul es\tedious\lib\connection.js:685:22) at MessageIO.emit (events.js:104:17) at MessageIO.eventData (C:\xampp\htdocs\Lavori\Bit_Sense\API_BS\node_modules \tedious\lib\message-io.js:58:21) at Socket. (C:\xampp\htdocs\Lavori\Bit_Sense\API_BS\node_modules\ tedious\lib\message-io.js:3:59) at Socket.emit (events.js:107:17) at readableAddChunk (_stream_readable.js:163:16) at Socket.Readable.push (_stream_readable.js:126:10) at TCP.onread (net.js:538:20)
I've installed this module: - sequelize ; - tedious ;
I haven't problem on the connection, only with this query:
db.KEY_ARTI.findAll({
where:{
CACODICE: cacodice
}
}).then(function(data) {
res.send(data);
});
What can I do ? I haven't ANY column called id
Here is my table:
var Sequelize = require('sequelize');
var settings = global.settings.databases.DATABASE;
var errors = global.errors;
var utilities = global.utilities;
var sequelize = new Sequelize(settings.schema, settings.username, settings.password, {
dialect: settings.dialect,
host: settings.host,
port: settings.port, /* BISOGNA USARE LA DYNAMIC PORT */
logging: function (str) {
if(settings.log)
console.log("querylog: "+str.replace("Executing (default):", "") );
},
});
sequelize.authenticate().then(function(err) {
if (!!err) {
console.log('Database '+settings.schema+' Connection Error:', err)
}
else {
console.log('Database '+settings.schema+' Connected')
}
});
exports.sequelize = sequelize;
/*
* KEY_ARTI
*/
exports.KEY_ARTI = sequelize.define('KEY_ARTI', {
CACODICE: Sequelize.CHAR(20),
CADESART: Sequelize.CHAR(40),
}