I am using Sails alongside its Waterline ORM for PostgreSQL. I am having an issue with the defaultsTo
parameter in model attribute definition.
Here is a part of my Model definition:
module.exports = {
tableName: 'table',
attributes: {
[...]
reach: {
type: 'number',
defaultsTo: 0,
}
[...]
}
}
When using Model.create()
, I get this console warning:
Warning: After transforming columnNames back to attribute names for model `model`,
a record in the result has a value with an unexpected data type for property `reach`.
The corresponding attribute declares `type: 'number'` but instead
of that, the actual value is:
` ` `
'0'
` ` `
I have a bunch of number
type attributes so this leads to a lot of warnings in my console.
At this point, I believe this is a waterline issue but do you have a workaround to avoid this warning?
Edit
My warning is only appearing for Postgres "BIGINT" column I am starting to undersand that JS cannot handle postgres BIGINT as number so it must be converted to string.