node.js - Error in find() Sails.js with MySQL database -


i have been working sails.js , mongodb, want work sql db , i'm finding problems can't solve.

i defined model

api/models/carta.js

module.exports.models = {     connection:   "mysql",   tablename:    "carta",    attributes: {     id              :   { type: 'int',    required: true, unique: true },     a_categoria     :   { type: 'int',    required: true, unique: true },     categoria       :   { type: 'string', required: true, unique: true },   } } 

the connection

 mysql:  {     adapter: 'sails-mysql',     host: 'localhost',     port: 3306,     user: 'root',     password: '',     database: 'maangatuts'   } 

through mysql workbench created db "maangatuts"

create table `maangatuts`.`carta` (  `id` int not null comment '',  `a_categoria` int not null comment '',  `categoria` varchar(45) not null comment '',  primary key (`id`)  comment ''); 

and add 2 rows data.

until here right, when in sails console type:

carta.find().exec(function(err,a){console.log(err)}) 

error (e_unknown) :: encountered unexpected error : er_bad_field_error: unknown column 'carta.id' in 'field list'

do know happening? in advance!


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -