Skip to content

Commit 881275f

Browse files
authored
Merge pull request #280 from andezzat/fix/registerdatastore
Fix registerDatastore Property Checks
2 parents ec9601d + 8df9566 commit 881275f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

helpers/register-data-store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ module.exports = require('machine').build({
116116

117117
_.each(modelDef.definition, function checkAttributes(attribute, attributeName) {
118118

119-
if (attribute.type === 'number' && attribute.autoMigrations.columnType === 'bigint' && !attribute.autoCreatedAt && !attribute.autoUpdatedAt) {
119+
if (attribute.type === 'number' && attribute.autoMigrations && attribute.autoMigrations.columnType === 'bigint' && !attribute.autoCreatedAt && !attribute.autoUpdatedAt) {
120120
throw flaverr('E_BIGINT_TYPE_MISMATCH', new Error('\nIn attribute `' + attributeName + '` of model `' + modelIdentity + '`:\nThe `bigint` column type cannot be used with the `number` attribute type.\nSince `bigint` values may be larger than the maximum JavaScript integer size, PostgreSQL will return them as strings.\nTherefore, attributes using this column type must be declared as type `string`, `ref` or `json`.\n'));
121121
}
122122

test/adapter/unit/registerdatastore.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ describe('Unit Tests ::', function() {
5555
autoMigrations: {
5656
columnType: 'bigint'
5757
}
58+
},
59+
anotherGood: {
60+
type: 'number'
5861
}
5962
};
6063
var collections = {};

0 commit comments

Comments
 (0)