title: Sails API fetch error (500) ER_BAD_FIELD_ERROR
body: <p>I am beginner to sails and I am trying to create my first API using sails and mysql. I tried to create the table in my mysql console and made the configuration to the configuration.js file and trying to access the API from POSTMAN in chrome browser. I am getting the below error from the sails server. My query doesn't have the field and not sure if these fields are standard and getting appended in the query and not sure how to create these as a part of table automatically.</p>
  
  <pre><code>error: Sending 500 ("Server Error") response:
   Error (E_UNKNOWN) :: Encountered an unexpected error
  : ER_BAD_FIELD_ERROR: Unknown column 'message.createdAt' in 'field list'
      at Query.Sequence._packetToError (C:\MyApi\node_modules\sails-mysql\node_mod
  ules\mysql\lib\protocol\sequences\Sequence.js:48:14)
      at Query.ErrorPacket (C:\MyApi\node_modules\sails-mysql\node_modules\mysql\l
  ib\protocol\sequences\Query.js:82:18)
      at Protocol._parsePacket (C:\MyApi\node_modules\sails-mysql\node_modules\mys
  ql\lib\protocol\Protocol.js:271:23)
      at Parser.write (C:\MyApi\node_modules\sails-mysql\node_modules\mysql\lib\pr
  otocol\Parser.js:77:12)
      at Protocol.write (C:\MyApi\node_modules\sails-mysql\node_modules\mysql\lib\
  protocol\Protocol.js:39:16)
      at Socket.&lt;anonymous&gt; (C:\MyApi\node_modules\sails-mysql\node_modules\mysql\
  lib\Connection.js:82:28)
      at Socket.emit (events.js:95:17)
      at Socket.&lt;anonymous&gt; (_stream_readable.js:765:14)
      at Socket.emit (events.js:92:17)
      at emitReadable_ (_stream_readable.js:427:10)
      at emitReadable (_stream_readable.js:423:5)
      at readableAddChunk (_stream_readable.js:166:9)
      at Socket.Readable.push (_stream_readable.js:128:10)
      at TCP.onread (net.js:529:21)
      --------------------
      at Protocol._enqueue (C:\MyApi\node_modules\sails-mysql\node_modules\mysql\l
  ib\protocol\Protocol.js:135:48)
      at PoolConnection.Connection.query (C:\MyApi\node_modules\sails-mysql\node_m
  odules\mysql\lib\Connection.js:185:25)
      at __FIND__ (C:\MyApi\node_modules\sails-mysql\lib\adapter.js:836:20)
      at afterwards (C:\MyApi\node_modules\sails-mysql\lib\connections\spawn.js:84
  :5)
      at C:\MyApi\node_modules\sails-mysql\lib\connections\spawn.js:40:7
      at Ping.onPing [as _callback] (C:\MyApi\node_modules\sails-mysql\node_module
  s\mysql\lib\Pool.js:94:5)
      at Ping.Sequence.end (C:\MyApi\node_modules\sails-mysql\node_modules\mysql\l
  ib\protocol\sequences\Sequence.js:96:24)
      at Ping.Sequence.OkPacket (C:\MyApi\node_modules\sails-mysql\node_modules\my
  sql\lib\protocol\sequences\Sequence.js:105:8)
      at Protocol._parsePacket (C:\MyApi\node_modules\sails-mysql\node_modules\mys
  ql\lib\protocol\Protocol.js:271:23)
      at Parser.write (C:\MyApi\node_modules\sails-mysql\node_modules\mysql\lib\pr
  otocol\Parser.js:77:12)
      at Protocol.write (C:\MyApi\node_modules\sails-mysql\node_modules\mysql\lib\
  protocol\Protocol.js:39:16)
      at Socket.&lt;anonymous&gt; (C:\MyApi\node_modules\sails-mysql\node_modules\mysql\
  lib\Connection.js:82:28)
      at Socket.emit (events.js:95:17)
      at Socket.&lt;anonymous&gt; (_stream_readable.js:765:14)
      at Socket.emit (events.js:92:17)
      at emitReadable_ (_stream_readable.js:427:10)
  
  Details:  Error: ER_BAD_FIELD_ERROR: Unknown column 'message.createdAt' in 'fiel
  d list'
  </code></pre>
  
  <p>but I am getting the above error, below is my table.</p>
  
  <pre><code>mysql&gt; desc message
      -&gt; ;
  +-------+-------------+------+-----+---------+----------------+
  | Field | Type        | Null | Key | Default | Extra          |
  +-------+-------------+------+-----+---------+----------------+
  | name  | varchar(20) | YES  |     | NULL    |                |
  | id    | int(4)      | NO   | PRI | NULL    | auto_increment |
  +-------+-------------+------+-----+---------+----------------+
  2 rows in set (0.03 sec)
  </code></pre>
  
  <p>and I have the below as my code in model message.js</p>
  
  <pre><code>module.exports = {
  connection: 'someMysqlServer',
    attributes: {
          name: { type: 'string',
                   required: true}
  
    }
  };
  </code></pre>