"Unknown column error" from database.

Omar Martin
Omar Martin used Ask the Experts™
on
I am getting an error when I run my node app using sequelize - 'Unknown column \'general_comments\' in \'field list\''. However, as seen below, I have a model with the column....general_comments.  Please see the error log below and the model code for compressor

Server started on port 5000
Executing (default): SELECT 1+1 AS result
Connection has been established successfully.
http://localhost:5000/api/alldatac:2019-09-19T05:03:25-04:00
Executing (default): SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;
{ SequelizeDatabaseError: Unknown column 'general_comments' in 'field list'
    at Query.formatError (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\sequelize\lib\dialects\mysql\query.js:244:16)
    at Query.handler [as onResult] (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\sequelize\lib\dialects\mysql\query.js:51:23)
    at Query.execute (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\commands\command.js:30:14)
    at Connection.handlePacket (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:408:32)
    at PacketParser.Connection.packetParser.p [as onPacket] (C:\Users\Chrystelle\Omar Martin\Dropbox\web
design\hurricane_dorian\node_modules\mysql2\lib\connection.js:70:12)
    at PacketParser.executeStart (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packet_parser.js:75:16)
    at Socket.Connection.stream.on.data (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:77:25)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
  name: 'SequelizeDatabaseError',
  parent:
   { Error: Unknown column 'general_comments' in 'field list'
       at Packet.asError (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packets\packet.js:708:17)
       at Query.execute (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\commands\command.js:28:26)
       at Connection.handlePacket (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:408:32)
       at PacketParser.Connection.packetParser.p [as onPacket] (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:70:12)
       at PacketParser.executeStart (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packet_parser.js:75:16)
       at Socket.Connection.stream.on.data (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:77:25)
       at Socket.emit (events.js:198:13)
       at addChunk (_stream_readable.js:288:12)
       at readableAddChunk (_stream_readable.js:269:11)
       at Socket.Readable.push (_stream_readable.js:224:10)
       at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
     code: 'ER_BAD_FIELD_ERROR',
     errno: 1054,
     sqlState: '42S22',
     sqlMessage: 'Unknown column \'general_comments\' in \'field list\'',
     sql:
      'SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;',
     parameters: undefined },
  original:
   { Error: Unknown column 'general_comments' in 'field list'
       at Packet.asError (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packets\packet.js:708:17)
       at Query.execute (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\commands\command.js:28:26)
       at Connection.handlePacket (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:408:32)
       at PacketParser.Connection.packetParser.p [as onPacket] (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:70:12)
       at PacketParser.executeStart (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packet_parser.js:75:16)
       at Socket.Connection.stream.on.data (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:77:25)
       at Socket.emit (events.js:198:13)
       at addChunk (_stream_readable.js:288:12)
       at readableAddChunk (_stream_readable.js:269:11)
       at Socket.Readable.push (_stream_readable.js:224:10)
       at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
     code: 'ER_BAD_FIELD_ERROR',
     errno: 1054,
     sqlState: '42S22',
     sqlMessage: 'Unknown column \'general_comments\' in \'field list\'',
     sql:
      'SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;',
     parameters: undefined },
  sql:
   'SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;',
  parameters: undefined }
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] starting `node app.js`
Server started on port 5000
Executing (default): SELECT 1+1 AS result
Connection has been established successfully.
http://localhost:5000/api/alldatac:2019-09-19T05:12:57-04:00
Executing (default): SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;
{ SequelizeDatabaseError: Unknown column 'general_comments' in 'field list'
    at Query.formatError (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\sequelize\lib\dialects\mysql\query.js:244:16)
    at Query.handler [as onResult] (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\sequelize\lib\dialects\mysql\query.js:51:23)
    at Query.execute (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\commands\command.js:30:14)
    at Connection.handlePacket (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:408:32)
    at PacketParser.Connection.packetParser.p [as onPacket] (C:\Users\Chrystelle\Omar Martin\Dropbox\web
design\hurricane_dorian\node_modules\mysql2\lib\connection.js:70:12)
    at PacketParser.executeStart (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packet_parser.js:75:16)
    at Socket.Connection.stream.on.data (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:77:25)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
  name: 'SequelizeDatabaseError',
  parent:
   { Error: Unknown column 'general_comments' in 'field list'
       at Packet.asError (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packets\packet.js:708:17)
       at Query.execute (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\commands\command.js:28:26)
       at Connection.handlePacket (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:408:32)
       at PacketParser.Connection.packetParser.p [as onPacket] (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:70:12)
       at PacketParser.executeStart (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packet_parser.js:75:16)
       at Socket.Connection.stream.on.data (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:77:25)
       at Socket.emit (events.js:198:13)
       at addChunk (_stream_readable.js:288:12)
       at readableAddChunk (_stream_readable.js:269:11)
       at Socket.Readable.push (_stream_readable.js:224:10)
       at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
     code: 'ER_BAD_FIELD_ERROR',
     errno: 1054,
     sqlState: '42S22',
     sqlMessage: 'Unknown column \'general_comments\' in \'field list\'',
     sql:
      'SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;',
     parameters: undefined },
  original:
   { Error: Unknown column 'general_comments' in 'field list'
       at Packet.asError (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packets\packet.js:708:17)
       at Query.execute (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\commands\command.js:28:26)
       at Connection.handlePacket (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:408:32)
       at PacketParser.Connection.packetParser.p [as onPacket] (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:70:12)
       at PacketParser.executeStart (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packet_parser.js:75:16)
       at Socket.Connection.stream.on.data (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:77:25)
       at Socket.emit (events.js:198:13)
       at addChunk (_stream_readable.js:288:12)
       at readableAddChunk (_stream_readable.js:269:11)
       at Socket.Readable.push (_stream_readable.js:224:10)
       at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
     code: 'ER_BAD_FIELD_ERROR',
     errno: 1054,
     sqlState: '42S22',
     sqlMessage: 'Unknown column \'general_comments\' in \'field list\'',
     sql:
      'SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;',
     parameters: undefined },
  sql:
   'SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;',
  parameters: undefined }
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] starting `node app.js`
Server started on port 5000
Executing (default): SELECT 1+1 AS result
Connection has been established successfully.
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] starting `node app.js`
Server started on port 5000
Executing (default): SELECT 1+1 AS result
Connection has been established successfully.
http://localhost:5000/api/alldatac:2019-09-19T05:34:27-04:00
Executing (default): SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;
{ SequelizeDatabaseError: Unknown column 'general_comments' in 'field list'
    at Query.formatError (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\sequelize\lib\dialects\mysql\query.js:244:16)
    at Query.handler [as onResult] (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\sequelize\lib\dialects\mysql\query.js:51:23)
    at Query.execute (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\commands\command.js:30:14)
    at Connection.handlePacket (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:408:32)
    at PacketParser.Connection.packetParser.p [as onPacket] (C:\Users\Chrystelle\Omar Martin\Dropbox\web
design\hurricane_dorian\node_modules\mysql2\lib\connection.js:70:12)
    at PacketParser.executeStart (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packet_parser.js:75:16)
    at Socket.Connection.stream.on.data (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:77:25)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
  name: 'SequelizeDatabaseError',
  parent:
   { Error: Unknown column 'general_comments' in 'field list'
       at Packet.asError (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packets\packet.js:708:17)
       at Query.execute (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\commands\command.js:28:26)
       at Connection.handlePacket (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:408:32)
       at PacketParser.Connection.packetParser.p [as onPacket] (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:70:12)
       at PacketParser.executeStart (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packet_parser.js:75:16)
       at Socket.Connection.stream.on.data (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:77:25)
       at Socket.emit (events.js:198:13)
       at addChunk (_stream_readable.js:288:12)
       at readableAddChunk (_stream_readable.js:269:11)
       at Socket.Readable.push (_stream_readable.js:224:10)
       at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
     code: 'ER_BAD_FIELD_ERROR',
     errno: 1054,
     sqlState: '42S22',
     sqlMessage: 'Unknown column \'general_comments\' in \'field list\'',
     sql:
      'SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;',
     parameters: undefined },
  original:
   { Error: Unknown column 'general_comments' in 'field list'
       at Packet.asError (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packets\packet.js:708:17)
       at Query.execute (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\commands\command.js:28:26)
       at Connection.handlePacket (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:408:32)
       at PacketParser.Connection.packetParser.p [as onPacket] (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:70:12)
       at PacketParser.executeStart (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packet_parser.js:75:16)
       at Socket.Connection.stream.on.data (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:77:25)
       at Socket.emit (events.js:198:13)
       at addChunk (_stream_readable.js:288:12)
       at readableAddChunk (_stream_readable.js:269:11)
       at Socket.Readable.push (_stream_readable.js:224:10)
       at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
     code: 'ER_BAD_FIELD_ERROR',
     errno: 1054,
     sqlState: '42S22',
     sqlMessage: 'Unknown column \'general_comments\' in \'field list\'',
     sql:
      'SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;',
     parameters: undefined },
  sql:
   'SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;',
  parameters: undefined }
http://localhost:5000/api/alldatac:2019-09-19T05:36:27-04:00
Executing (default): SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;
{ SequelizeDatabaseError: Unknown column 'general_comments' in 'field list'
    at Query.formatError (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\sequelize\lib\dialects\mysql\query.js:244:16)
    at Query.handler [as onResult] (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\sequelize\lib\dialects\mysql\query.js:51:23)
    at Query.execute (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\commands\command.js:30:14)
    at Connection.handlePacket (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:408:32)
    at PacketParser.Connection.packetParser.p [as onPacket] (C:\Users\Chrystelle\Omar Martin\Dropbox\web
design\hurricane_dorian\node_modules\mysql2\lib\connection.js:70:12)
    at PacketParser.executeStart (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packet_parser.js:75:16)
    at Socket.Connection.stream.on.data (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:77:25)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
  name: 'SequelizeDatabaseError',
  parent:
   { Error: Unknown column 'general_comments' in 'field list'
       at Packet.asError (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packets\packet.js:708:17)
       at Query.execute (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\commands\command.js:28:26)
       at Connection.handlePacket (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:408:32)
       at PacketParser.Connection.packetParser.p [as onPacket] (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:70:12)
       at PacketParser.executeStart (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packet_parser.js:75:16)
       at Socket.Connection.stream.on.data (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:77:25)
       at Socket.emit (events.js:198:13)
       at addChunk (_stream_readable.js:288:12)
       at readableAddChunk (_stream_readable.js:269:11)
       at Socket.Readable.push (_stream_readable.js:224:10)
       at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
     code: 'ER_BAD_FIELD_ERROR',
     errno: 1054,
     sqlState: '42S22',
     sqlMessage: 'Unknown column \'general_comments\' in \'field list\'',
     sql:
      'SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;',
     parameters: undefined },
  original:
   { Error: Unknown column 'general_comments' in 'field list'
       at Packet.asError (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packets\packet.js:708:17)
       at Query.execute (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\commands\command.js:28:26)
       at Connection.handlePacket (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:408:32)
       at PacketParser.Connection.packetParser.p [as onPacket] (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:70:12)
       at PacketParser.executeStart (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\packet_parser.js:75:16)
       at Socket.Connection.stream.on.data (C:\Users\Chrystelle\Omar Martin\Dropbox\web design\hurricane_dorian\node_modules\mysql2\lib\connection.js:77:25)
       at Socket.emit (events.js:198:13)
       at addChunk (_stream_readable.js:288:12)
       at readableAddChunk (_stream_readable.js:269:11)
       at Socket.Readable.push (_stream_readable.js:224:10)
       at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
     code: 'ER_BAD_FIELD_ERROR',
     errno: 1054,
     sqlState: '42S22',
     sqlMessage: 'Unknown column \'general_comments\' in \'field list\'',
     sql:
      'SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;',
     parameters: undefined },
  sql:
   'SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;',
  parameters: undefined }

Open in new window


Here is the model:
const Sequelize = require("sequelize");
const db = require("../middleware/db.js");
 
const compressorHouse = db.define(
  'compressor_house',
  {
    compressor_house_id: {
        type: Sequelize.INTEGER,
        primaryKey: true,
        autoIncrement: true
    },
 
    equipment_area: {
        type: Sequelize.STRING
    },
     
    equipment_type: {
        type: Sequelize.STRING
    },        
     
    photo_image: {
        type: Sequelize.STRING
    },
               
    manufacturer: {
        type: Sequelize.STRING
    },
 
    model_number: {
          type: Sequelize.STRING
    },
     
    serial_number: {
      type: Sequelize.STRING
    },

    service: {
        type: Sequelize.STRING
    },
 
    capacity: {
          type: Sequelize.STRING
    },
 
    severity: {
        type: Sequelize.STRING
    },
 
    general_comments: {
          type: Sequelize.STRING
    },
 
  },
 
  {
      timestamps: true,
  },
  {
    freezeTableName: true,
    },
  
    {
    tableName: 'compressor_house',
    },
  )

  //compressorHouse.sync({ force: true })
/*
// Note: using `force: true` will drop the table if it already exists
Store.sync({ force: true }).then(() => {
    // Now the `users` table in the database corresponds to the model definition
    return Store.create({
     Station: 'Bayshore OTR',
     Image: '2019/08/20T15/53/57.514Zcoconut.jpg',
     Address:'Bacardi Road',
     ['Monthly C-Store Sales']:'700',
     Operator:'Richard Sears',
     ['Top SKU']:'Hotdogs'
    });
  });
  */
 
  module.exports = compressorHouse

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
nociSoftware Engineer
Distinguished Expert 2018

Commented:
This is the query:
  'SELECT `compressor_house_id`, `equipment_area`, `equipment_type`, `photo_image`, `manufacturer`, `model_number`, `serial_number`, `service`, `capacity`, `severity`, `general_comments`, `createdAt`, `updatedAt` FROM `compressor_houses` AS `compressor_house`;',

And this is the error:
    code: 'ER_BAD_FIELD_ERROR',
     errno: 1054,
     sqlState: '42S22',
     sqlMessage: 'Unknown column \'general_comments\' in \'field list\'',

So now check your database: it most probably doesn't have a general_comments columns in the compressor_houses table.
Correct the name (in code or database) and it should work.
Omar MartinBridgemaker

Author

Commented:
The model has the field...see the model I provided above. For some reason, it is not recognizing the model.
nociSoftware Engineer
Distinguished Expert 2018

Commented:
please check the SQL database itself... The model  is some code abstraction you expect from the database.
Please check the database itself using the plsql or some other means to inspect the database.
Omar MartinBridgemaker

Author

Commented:
I checked using phpmyadmin....it has the field.....it appears to be a sequelize issue....
Bridgemaker
Commented:
I simply did a compressorHouse.sync({ force: true })  statement to recreate the model.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial