@graphile-contrib/pg-many-to-many
Advanced tools
Comparing version 1.0.0-beta.5 to 1.0.0-beta.6
{ | ||
"name": "@graphile-contrib/pg-many-to-many", | ||
"version": "1.0.0-beta.5", | ||
"version": "1.0.0-beta.6", | ||
"description": "Add connection fields for many-to-many relations", | ||
@@ -20,3 +20,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"eslint": "^5.13.0", | ||
"eslint": "^5.16.0", | ||
"eslint-config-prettier": "^4.0.0", | ||
@@ -26,3 +26,3 @@ "eslint-plugin-jest": "^22.2.2", | ||
"graphql": "^14.0.2", | ||
"jest": "^24.1.0", | ||
"jest": "^24.8.0", | ||
"pg": "^7.8.0", | ||
@@ -29,0 +29,0 @@ "postgraphile-core": "4.1.0", |
@@ -110,4 +110,6 @@ # @graphile-contrib/pg-many-to-many | ||
You can also override individual field names using `@manyToManyFieldName` and `@manyToManySimpleFieldName` smart comments: | ||
You can also override individual field names using `@manyToManyFieldName` and `@manyToManySimpleFieldName` smart comments. | ||
To rename the Connection field from `teamsByTeamMemberTeamId` to `teams`: | ||
```sql | ||
@@ -117,2 +119,6 @@ comment on constraint team_member_team_id_fkey on p.team_member is E'@manyToManyFieldName teams'; | ||
This changes the GraphQL field name from `teamsByTeamMemberTeamId` to `teams`. | ||
To rename both the Connection and simple collection fields (assuming simple collections are enabled): | ||
```sql | ||
comment on constraint team_member_team_id_fkey on p.team_member is E'@manyToManyFieldName teams\n@manyToManySimpleFieldName teamsList'; | ||
``` |
@@ -5,6 +5,2 @@ module.exports = function PgManyToManyRelationPlugin( | ||
) { | ||
const hasConnections = pgSimpleCollections !== "only"; | ||
const hasSimpleCollections = | ||
pgSimpleCollections === "only" || pgSimpleCollections === "both"; | ||
builder.hook("inflection", inflection => { | ||
@@ -342,2 +338,9 @@ return Object.assign(inflection, { | ||
} | ||
const simpleCollections = | ||
junctionRightConstraint.tags.simpleCollections || | ||
rightTable.tags.simpleCollections || | ||
pgSimpleCollections; | ||
const hasConnections = simpleCollections !== "only"; | ||
const hasSimpleCollections = | ||
simpleCollections === "only" || simpleCollections === "both"; | ||
if (hasConnections) { | ||
@@ -344,0 +347,0 @@ makeFields(true); |
20988
373
123