Skip to content

Commit 8df9566

Browse files
committed
Check that property autoMigrations exists before checking its child property columnType
No more undefined errors
1 parent a22cce4 commit 8df9566

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-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

0 commit comments

Comments
 (0)