Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to rename default CRUD operations? #974

Closed
1 of 3 tasks
saminiir opened this issue Jan 23, 2019 · 3 comments
Closed
1 of 3 tasks

How to rename default CRUD operations? #974

saminiir opened this issue Jan 23, 2019 · 3 comments

Comments

@saminiir
Copy link

I'm submitting a ...

  • bug report
  • feature request
  • question

PostGraphile version: 4.2.0

I have a table with PRIMARY KEY (first, second, third). This generates CRUD operations like updateTableByFirstAndSecondAndThird.

How to rename all the table's C(R)UD operations to e.g. updateTableByFirst, preserving the db schema's triple primary key?

I've tried smart commenting (COMMENT ON CONSTRAINT "table_pkey" ON "table" IS E'@fieldName tableByFirst';) but this only touches the Read operation -> query tableByFirst.

@benjie
Copy link
Member

benjie commented Jan 23, 2019

You can override the inflector for this mutation type and make it whatever you like; here’s the docs on that:

https://www.graphile.org/postgraphile/inflection/

I think what might work for you is to rename the mutations that use the primary key only; e.g. updateFooByPk; this is actually a smart idea anyway; I think I might add this to pg-simplify-inflector.

Another option is to use the updateTable(nodeId: ...) mutation.

@benjie
Copy link
Member

benjie commented Jan 23, 2019

@benjie
Copy link
Member

benjie commented Jan 30, 2019

[semi-automated message] Thanks for your question; hopefully we're well on the way to helping you solve your issue. This doesn't currently seem to be a bug in the library so I'm going to close the issue, but please feel free to keep requesting help below and if it does turn out to be a bug we can definitely re-open it 👍

@benjie benjie closed this as completed Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants