Skip to content

Commit 66e2fc5

Browse files
committed
consider enumerability of fields
1 parent 6d74caa commit 66e2fc5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Changelog
22

33

4-
##### 1.6.8 (2018-10-13)
4+
##### 1.6.9 (2018-10-13)
55
- Fix: do not allow extraneous fields in update to cause silent error.
66

77

lib/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ module.exports = Adapter => class PostgreSQLAdapter extends Adapter {
441441
const client = this.client
442442
const typeMap = this.options.typeMap
443443
const primaryKey = this.keys.primary
444-
const recordTypes = this.recordTypes
444+
const recordType = this.recordTypes[type]
445445

446446
// This is a little bit wrong, it is only safe to update within a
447447
// transaction. It's not possible to put it all in one update statement,
@@ -452,7 +452,7 @@ module.exports = Adapter => class PostgreSQLAdapter extends Adapter {
452452
let set = []
453453

454454
for (const field in update.replace) {
455-
if (!(field in recordTypes[type])) continue
455+
if (!recordType.propertyIsEnumerable(field)) continue
456456
const value = update.replace[field]
457457
index++
458458
if (Array.isArray(value)) parameters.push(value.map(inputValue))
@@ -461,7 +461,7 @@ module.exports = Adapter => class PostgreSQLAdapter extends Adapter {
461461
}
462462

463463
for (const field in update.push) {
464-
if (!(field in recordTypes[type])) continue
464+
if (!recordType.propertyIsEnumerable(field)) continue
465465
const value = update.push[field]
466466
index++
467467

@@ -476,7 +476,7 @@ module.exports = Adapter => class PostgreSQLAdapter extends Adapter {
476476
}
477477

478478
for (const field in update.pull) {
479-
if (!(field in recordTypes[type])) continue
479+
if (!recordType.propertyIsEnumerable(field)) continue
480480
const value = update.pull[field]
481481

482482
if (Array.isArray(value)) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "fortune-postgres",
33
"description": "Postgres adapter for Fortune.",
4-
"version": "1.6.8",
4+
"version": "1.6.9",
55
"license": "MIT",
66
"repository": {
77
"type": "git",

0 commit comments

Comments
 (0)