Skip to content

Commit d5a030c

Browse files
committed
fix: fix virtual constraint on complex types
Fix from mlipscombe#50
1 parent a599d38 commit d5a030c

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/PostgraphileNestedTypesPlugin.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -264,18 +264,20 @@ module.exports = function PostGraphileNestedTypesPlugin(
264264
type: GraphQLBoolean,
265265
};
266266
}
267-
pgNestedTableConnectorFields[foreignTable.id].forEach(
268-
({ field, fieldName: connectorFieldName }) => {
269-
operations[connectorFieldName] = {
270-
description: `The primary key(s) for \`${foreignTableName}\` for the far side of the relationship.`,
271-
type: isForward
272-
? field
273-
: isUnique
274-
? field
275-
: new GraphQLList(new GraphQLNonNull(field)),
276-
};
277-
},
278-
);
267+
if (pgNestedTableConnectorFields[foreignTable.id]) {
268+
pgNestedTableConnectorFields[foreignTable.id].forEach(
269+
({ field, fieldName: connectorFieldName }) => {
270+
operations[connectorFieldName] = {
271+
description: `The primary key(s) for \`${foreignTableName}\` for the far side of the relationship.`,
272+
type: isForward
273+
? field
274+
: isUnique
275+
? field
276+
: new GraphQLList(new GraphQLNonNull(field)),
277+
};
278+
},
279+
);
280+
}
279281
if (deleteable) {
280282
pgNestedTableDeleterFields[foreignTable.id].forEach(
281283
({ field, fieldName: deleterFieldName }) => {

0 commit comments

Comments
 (0)