senecajs/seneca-sqlite-store

Fix number literals are always cast to numbers regardless of the column type

Opened this issue · 0 comments

There seems to be a bug in the plugin. Let's say we have a row price defined as varchar in a products table defined like so:

# ... rest of the definition
price VARCHAR(255) NOT NULL,
# ... rest of the definition

Then we create a product like so:

app.make('products')
  .data$({ price: '3.95' })
  .save$(fin)

Then we list products like so:

app.make('products').list$(cb)

The products in the list will have their price cast into a Number, whereas the expected behavior would be for numbers to remain as strings. The following code may be the culprit: https://github.com/senecajs-labs/seneca-sqlite-store/blob/master/lib/sqlite-store.js#L559