Skip to content

Commit

Permalink
Specify number column types (Fixes #316) (#317)
Browse files Browse the repository at this point in the history
WaterlineJS defaults to using floating point field types for number
fields. The causes precision issues for file sizes since the reported
file sizes do not match the assets. This would also prevent the download
count tracking to work once the count is high enough such that one
download is beyond the supported precision.

Note: users must update their existing database schemas to avoid these
issues.
  • Loading branch information
ArekSredzki authored Jan 24, 2023
1 parent 6aca5a2 commit 006aaee
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/models/Asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ module.exports = {

size: {
type: 'number',
required: true
required: true,
columnType: 'integer'
},

download_count: {
type: 'number',
defaultsTo: 0
defaultsTo: 0,
columnType: 'integer'
},

version: {
Expand Down

0 comments on commit 006aaee

Please sign in to comment.