Problem when field name contains numbers
duard opened this issue · comments
I'm trying to insert some data on my table.
That table has a field called MED_PLA17
But BookShelf dont recognize when I try to set this field
const record = {
medAbc: resource.ID_PRODUTO,
medCtr: resource.NOME_FABRICANTE,
medCap: resource.CAP,
medTarja: resource.ID_TARJA,
medAbc: resource.ID_PRODUTO,
labNom: resource.NOME_FABRICANTE,
medTipmed: resource.DESCRICAO_TIPO_PRODUTO,
medDes: resource.NOME,
medApr: resource.DESCRICAO,
medPrinci: resource.COMPOSICAO,
medBarra: resource.EAN,
medLab: resource.ID_FABRICANTE,
medNegpos: resource.ID_LCCT,
medPla17: resource.MED_PLA17
// medPLA175: resource.PF_17_5,
// medPLA18: resource.PF_18,
// medPla_12: resource.PF_12,
// medPla20: resource.PF_20
};
console.log(`${JSON.stringify(record)}`);
return new Resource(record).save().then(resource => resource.refresh());
{"medAbc":"240402","medCtr":"AUROBINDO PHARMA","medCap":"0","medTarja":"TV","labNom":"AUROBINDO PHARMA","medTipmed":"GENERICO","medDes":"AMPICILINA SODICA","medApr":"500mg po sol inj x 50fa emb hosp","medPrinci":"AMPICILINA SODICA","medBarra":"7898361884611","medLab":"435","medNegpos":"+","medPla17":"125.64"}
The error
2018-04-11T19:19:51.279Z - error: Error: ER_BAD_FIELD_ERROR: Unknown column 'med_pla_17' in 'field list'
You don't have a column med_pla_17
in your table. This does not look like a bookshelf issue.